gmazza      2005/03/04 20:10:36

  Modified:    src/java/org/apache/fop/fo/flow ListItemBody.java
                        TableHeader.java
               src/java/org/apache/fop/fo/pagination Flow.java
  Log:
  validateChildNode() for fo:list-item-body implemented; redundant check in 
flow removed.
  
  Revision  Changes    Path
  1.22      +28 -0     xml-fop/src/java/org/apache/fop/fo/flow/ListItemBody.java
  
  Index: ListItemBody.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ListItemBody.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ListItemBody.java 28 Oct 2004 10:00:21 -0000      1.21
  +++ ListItemBody.java 5 Mar 2005 04:10:36 -0000       1.22
  @@ -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 @@
       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 @@
       }
   
       /**
  +     * @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();
       }
   
  
  
  
  1.13      +0 -1      xml-fop/src/java/org/apache/fop/fo/flow/TableHeader.java
  
  Index: TableHeader.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableHeader.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TableHeader.java  5 Mar 2005 00:32:25 -0000       1.12
  +++ TableHeader.java  5 Mar 2005 04:10:36 -0000       1.13
  @@ -25,7 +25,6 @@
   
   /**
    * Class modelling the fo:table-header object.
  - * @todo implement validateChildNode()
    */
   public class TableHeader extends TableBody {
   
  
  
  
  1.39      +1 -6      xml-fop/src/java/org/apache/fop/fo/pagination/Flow.java
  
  Index: Flow.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Flow.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- Flow.java 24 Dec 2004 12:06:26 -0000      1.38
  +++ Flow.java 5 Mar 2005 04:10:36 -0000       1.39
  @@ -66,11 +66,6 @@
        * @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");
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to