]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
PR:
authorGlen Mazza <gmazza@apache.org>
Sat, 5 Mar 2005 04:10:36 +0000 (04:10 +0000)
committerGlen Mazza <gmazza@apache.org>
Sat, 5 Mar 2005 04:10:36 +0000 (04:10 +0000)
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

src/java/org/apache/fop/fo/flow/ListItemBody.java
src/java/org/apache/fop/fo/flow/TableHeader.java
src/java/org/apache/fop/fo/pagination/Flow.java

index 883f52a21e3f5f5d8ba63e10d3ed4f0859b75afb..8a79dc988bb1eb5960ca25dbf4c067fd0a8e4ab6 100644 (file)
 
 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();
     }
 
index 8aa222ec6790f4d18c27e9e1449e0698c959fa7b..41187b060ecd7fa9dd6559af8fc7c04a66a1f839 100644 (file)
@@ -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 {
 
index 8ffa067fe0923da7e5df399ac8523d69bd04b787..81e079cb81ebde99cf89fa07483d714a5f1b7d7d 100644 (file)
@@ -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");
         }