From b4004d6e654286b543db6404a357b2b84c00658d Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Sun, 4 Jul 2004 05:15:38 +0000 Subject: [PATCH] validateChildNode() activated for fo:flow. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197752 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/FONode.java | 2 +- .../org/apache/fop/fo/pagination/Flow.java | 22 ++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index a542706a5..16043c00e 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -258,7 +258,7 @@ public abstract class FONode { protected void nodesOutOfOrderError(Locator loc, String tooLateNode, String tooEarlyNode) { throw new IllegalArgumentException( - errorText(loc) + getName() + ", " + tooLateNode + errorText(loc) + "For " + getName() + ", " + tooLateNode + " must be declared before " + tooEarlyNode + "."); } diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index 00b5ff7c9..6d8b7966d 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -28,6 +28,7 @@ import org.xml.sax.Locator; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOElementMapping; import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.apps.FOPException; @@ -56,6 +57,11 @@ public class Flow extends FObj { */ private int contentWidth; + /** + * Content-width of current column area during layout + */ + private boolean blockItemFound = false; + /** * @param parent FONode that is the parent of this object */ @@ -65,15 +71,19 @@ public class Flow extends FObj { /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) - * XSL/FOP Content Model: markers* (%block;)+ + * XSL/FOP Content Model: marker* (%block;)+ */ -/* temporarily disabled: need to account for fo-markers which may be initial children protected void validateChildNode(Locator loc, String nsURI, String localName) { - if (!isBlockItem(nsURI, localName)) { + if (nsURI == FOElementMapping.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 @@ -81,8 +91,8 @@ public class Flow extends FObj { * @see org.apache.fop.fo.FONode#end */ protected void end() { - if (children == null) { - missingChildElementError("(%block;)+"); + if (!blockItemFound) { + missingChildElementError("marker* (%block;)+"); } getFOInputHandler().endFlow(this); } -- 2.39.5