diff options
author | Glen Mazza <gmazza@apache.org> | 2005-03-05 04:10:36 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2005-03-05 04:10:36 +0000 |
commit | e7450b91fbd4ba6eba950faab0c27e2c17a58d85 (patch) | |
tree | 860ad8c33a5a0566c704f6aae381cec73300c27b /src | |
parent | 44bb5929dc670688c9ce7771cd06a5e132cd24a8 (diff) | |
download | xmlgraphics-fop-e7450b91fbd4ba6eba950faab0c27e2c17a58d85.tar.gz xmlgraphics-fop-e7450b91fbd4ba6eba950faab0c27e2c17a58d85.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/fo/flow/ListItemBody.java | 28 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/flow/TableHeader.java | 1 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/Flow.java | 5 |
3 files changed, 28 insertions, 6 deletions
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"); } |