]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Access master-name through propertySets.
authorPeter Bernard West <pbwest@apache.org>
Wed, 2 Oct 2002 07:26:01 +0000 (07:26 +0000)
committerPeter Bernard West <pbwest@apache.org>
Wed, 2 Oct 2002 07:26:01 +0000 (07:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@195270 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/pagination/FoSimplePageMaster.java

index f9925eb040fa0f901568758eaff7f00c449a59eb..d14a963d058ae74821d57fefe48d0260889cc8d4 100644 (file)
@@ -11,6 +11,7 @@ package org.apache.fop.fo.pagination;
 
 // FOP
 import org.apache.fop.fo.FOAttributes;
+import org.apache.fop.fo.PropNames;
 import org.apache.fop.xml.XMLEvent;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FObjects;
@@ -19,6 +20,8 @@ import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FOTree;
 import org.apache.fop.fo.expr.PropertyException;
 import org.apache.fop.datastructs.Tree;
+import org.apache.fop.datatypes.PropertyValue;
+import org.apache.fop.datatypes.NCName;
 
 /**
  * Implements the fo:simple-page-master flow object
@@ -42,11 +45,13 @@ public class FoSimplePageMaster extends FONode {
         super(foTree, FObjectNames.SIMPLE_PAGE_MASTER, parent, event,
               FObjects.LAYOUT_SET);
         System.out.println("FOAttributes: " + event);
-        try {
-            masterName = foAttributes.getFoAttrValue("master-name");
-        } catch (PropertyException e) {
-            throw new FOPException(e.getMessage());
-        }
+        // Check that the property has been set
+        PropertyValue name = propertySet[PropNames.MASTER_NAME];
+        if (name == null)
+            throw new PropertyException("master-name property not set");
+        if (name.getType() != PropertyValue.NCNAME)
+            throw new PropertyException("master-name property not an NCName.");
+        masterName = ((NCName)name).getNCName();
         // Process regions here
         XMLEvent ev = xmlevents.getEndElement(event);
     }