pbwest      2002/10/24 07:53:46

  Modified:    src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design FoRoot.java
  Log:
  Changed XMLEvent to FoXMLEvent throughout.
  Account for the fact that 'expect' methods returning FoXMLEvents return null on 
failure.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.11  +18 -14    xml-fop/src/org/apache/fop/fo/Attic/FoRoot.java
  
  Index: FoRoot.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/FoRoot.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- FoRoot.java       19 Oct 2002 03:49:04 -0000      1.1.2.10
  +++ FoRoot.java       24 Oct 2002 14:53:46 -0000      1.1.2.11
  @@ -18,9 +18,10 @@
   import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.expr.PropertyException;
   import org.apache.fop.fo.pagination.FoLayoutMasterSet;
  +import org.apache.fop.xml.FoXMLEvent;
   import org.apache.fop.xml.XMLEvent;
   import org.apache.fop.xml.XMLNamespaces;
  -import org.apache.fop.xml.SyncedXmlEventsBuffer;
  +import org.apache.fop.xml.SyncedFoXmlEventsBuffer;
   
   import org.xml.sax.Attributes;
   
  @@ -44,11 +45,11 @@
   
       /**
        * @param foTree the FO tree being built
  -     * @param event the <tt>XMLEvent</tt> that triggered the creation of this
  +     * @param event the <tt>FoXMLEvent</tt> that triggered the creation of this
        * node
        */
       public FoRoot
  -        (FOTree foTree, XMLEvent event)
  +        (FOTree foTree, FoXMLEvent event)
           throws Tree.TreeException, FOPException, PropertyException
       {
           // This is the root node of the tree; hence the null argument
  @@ -80,7 +81,7 @@
        * in the page-sequence-sequence.
        */
       public void buildFoTree() throws FOPException{
  -        XMLEvent ev;
  +        FoXMLEvent ev;
           System.out.println("buildFoTree: " + event);
           // Look for layout-master-set
           try {
  @@ -88,7 +89,7 @@
                       (XMLNamespaces.XSLNSpaceIndex, "layout-master-set",
                                                       XMLEvent.DISCARD_W_SPACE);
           } catch (NoSuchElementException e) {
  -            throw new FOPException(e);
  +            throw new FOPException("buildFoTree: Unexpected EOF in 
layout-master-set.");
           }
           // Process the layout-master-set
           try {
  @@ -100,15 +101,18 @@
           }
           // Look for optional declarations
           try {
  -            xmlevents.expectStartElement
  +            ev = xmlevents.expectStartElement
                           (XMLNamespaces.XSLNSpaceIndex, "declarations",
                                                       XMLEvent.DISCARD_W_SPACE);
  -            // process the declarations
  -            xmlevents.getEndElement
  -                    (XMLNamespaces.XSLNSpaceIndex, "declarations");
  +            if (ev != null) {
  +                // process the declarations
  +                xmlevents.getEndElement
  +                        (XMLNamespaces.XSLNSpaceIndex, "declarations");
  +            }
           } catch (NoSuchElementException e) {
  -            // Take no notice - declarations is optional
  +            throw new FOPException
  +                ("Unexpected EOF while processing declarations.");
           }
  -        
  +
       }
   }
  
  
  

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

Reply via email to