]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
More solid checking to ensure first node encountered is an fo:root FO.
authorGlen Mazza <gmazza@apache.org>
Sat, 12 Jun 2004 18:52:08 +0000 (18:52 +0000)
committerGlen Mazza <gmazza@apache.org>
Sat, 12 Jun 2004 18:52:08 +0000 (18:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197702 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/FOTreeBuilder.java
src/java/org/apache/fop/fo/FObj.java

index 59a16095a083b8054ca179bd6fd9f634cc62a8c1..f49439a41211f15f2e7fcddcb33276e141dc286b 100644 (file)
@@ -224,7 +224,14 @@ public class FOTreeBuilder extends DefaultHandler {
         /* the node found in the FO document */
         FONode foNode;
 
-        /* the maker for the formatting object started */
+        // Check to ensure first node encountered is an fo:root
+        if (rootFObj == null) {
+            if (!namespaceURI.equals(FObj.FO_URI) || !localName.equals("root")) {
+                throw new SAXException(new FOPException("Error:  Root element" +
+                    " must be fo:root formatting object"));
+            }
+        }
+        
         ElementMapping.Maker fobjMaker = findFOMaker(namespaceURI, localName);
 
 //      System.out.println("found a " + fobjMaker.toString());
@@ -237,11 +244,6 @@ public class FOTreeBuilder extends DefaultHandler {
         }
 
         if (rootFObj == null) {
-            if (!foNode.getName().equals("fo:root")) {
-                throw new SAXException(new FOPException("Root element must"
-                                                        + " be fo:root, not "
-                                                        + foNode.getName()));
-            }
             rootFObj = (Root) foNode;
             rootFObj.setFOTreeControl(foTreeControl);
         } else {
index 3f17965cf13eaa1ce98c8f09242041b68601ad96..1ecfc1aa706933d82c2bf110870d723ecbced0c9 100644 (file)
@@ -36,7 +36,7 @@ import org.xml.sax.Locator;
  * Base class for representation of formatting objects and their processing.
  */
 public class FObj extends FONode implements Constants {
-    private static final String FO_URI = "http://www.w3.org/1999/XSL/Format";
+    public static final String FO_URI = "http://www.w3.org/1999/XSL/Format";
 
     public static PropertyMaker[] propertyListTable = null;