From: Glen Mazza Date: Sat, 5 Mar 2005 04:10:36 +0000 (+0000) Subject: PR: X-Git-Tag: Root_Temp_KnuthStylePageBreaking~38 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e7450b91fbd4ba6eba950faab0c27e2c17a58d85;p=xmlgraphics-fop.git PR: Obtained from: Submitted by: Reviewed by: validateChildNode() for fo:list-item-body implemented; redundant check in flow removed. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198469 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/flow/ListItemBody.java b/src/java/org/apache/fop/fo/flow/ListItemBody.java index 883f52a21..8a79dc988 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemBody.java +++ b/src/java/org/apache/fop/fo/flow/ListItemBody.java @@ -18,9 +18,12 @@ package org.apache.fop.fo.flow; +import org.xml.sax.Locator; + import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.ValidationException; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.KeepProperty; @@ -36,6 +39,9 @@ public class ListItemBody extends FObj { private KeepProperty keepTogether; // End of property values + /** used for FO validation */ + private boolean blockItemFound = false; + /** * @param parent FONode that is the parent of this object */ @@ -61,9 +67,31 @@ public class ListItemBody extends FObj { } /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + * XSL Content Model: marker* (%block;)+ + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws ValidationException { + if (nsURI == FO_URI && localName.equals("marker")) { + if (blockItemFound) { + nodesOutOfOrderError(loc, "fo:marker", "(%block;)"); + } + } else if (!isBlockItem(nsURI, localName)) { + invalidChildError(loc, nsURI, localName); + } else { + blockItemFound = true; + } + } + + /** + * Make sure content model satisfied, if so then tell the + * FOEventHandler that we are at the end of the flow. * @see org.apache.fop.fo.FONode#endOfNode */ protected void endOfNode() throws FOPException { + if (!blockItemFound) { + missingChildElementError("marker* (%block;)+"); + } getFOEventHandler().endListBody(); } diff --git a/src/java/org/apache/fop/fo/flow/TableHeader.java b/src/java/org/apache/fop/fo/flow/TableHeader.java index 8aa222ec6..41187b060 100644 --- a/src/java/org/apache/fop/fo/flow/TableHeader.java +++ b/src/java/org/apache/fop/fo/flow/TableHeader.java @@ -25,7 +25,6 @@ import org.apache.fop.fo.FONode; /** * Class modelling the fo:table-header object. - * @todo implement validateChildNode() */ public class TableHeader extends TableBody { diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index 8ffa067fe..81e079cb8 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -66,11 +66,6 @@ public class Flow extends FObj { * @see org.apache.fop.fo.FONode#startOfNode */ protected void startOfNode() throws FOPException { - if (!parent.getName().equals("fo:page-sequence")) { - throw new ValidationException("flow must be child of " - + "page-sequence, not " + parent.getName(), locator); - } - if (flowName == null || flowName.equals("")) { missingPropertyError("flow-name"); }