aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java14
-rw-r--r--src/java/org/apache/fop/fo/FObj.java2
2 files changed, 9 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index 59a16095a..f49439a41 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -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 {
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java
index 3f17965cf..1ecfc1aa7 100644
--- a/src/java/org/apache/fop/fo/FObj.java
+++ b/src/java/org/apache/fop/fo/FObj.java
@@ -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;