pbwest 2002/10/27 16:08:12 Modified: src/org/apache/fop/fo/pagination Tag: FOP_0-20-0_Alt-Design FoLayoutMasterSet.java FoPageSequenceMaster.java FoSimplePageMaster.java Log: Use foType in get/expect calls. Revision Changes Path No revision No revision 1.1.2.11 +11 -13 xml-fop/src/org/apache/fop/fo/pagination/Attic/FoLayoutMasterSet.java Index: FoLayoutMasterSet.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Attic/FoLayoutMasterSet.java,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- FoLayoutMasterSet.java 24 Oct 2002 14:58:14 -0000 1.1.2.10 +++ FoLayoutMasterSet.java 28 Oct 2002 00:08:11 -0000 1.1.2.11 @@ -42,15 +42,13 @@ private static final String revision = "$Revision$"; /** - * An array with <tt>UriLocalName</tt> objects identifying + * An array with <tt>int</tt>s identifying * <tt>simple-page-master</tt> and <tt>page-sequence-master</tt> * XML events. */ - private static final UriLocalName[] simpleOrSequenceMaster = { - new UriLocalName - (XMLNamespaces.XSLNSpaceIndex, "simple-page-master"), - new UriLocalName - (XMLNamespaces.XSLNSpaceIndex, "page-sequence-master") + private static final int[] simpleOrSequenceMaster = { + FObjectNames.SIMPLE_PAGE_MASTER, + FObjectNames.PAGE_SEQUENCE_MASTER }; /** @@ -99,7 +97,7 @@ { FoSimplePageMaster simple; String masterName; - String localName; + int foType; FoPageSequenceMaster foPageSeq; try { do { @@ -107,8 +105,8 @@ xmlevents.expectStartElement (simpleOrSequenceMaster, XMLEvent.DISCARD_W_SPACE); if (ev == null) break; // No instance of these elements found - localName = ev.getLocalName(); - if (localName.equals("simple-page-master")) { + foType = ev.getFoType(); + if (foType == FObjectNames.SIMPLE_PAGE_MASTER) { //System.out.println("Found simple-page-master"); simple = new FoSimplePageMaster(foTree, this, ev); masterName = simple.getMasterName(); @@ -123,7 +121,7 @@ ("simple-page-master master-name clash in " + "simplePageMasters: " + masterName); simplePageMasters.put(masterName, simple); - } else if (localName.equals("page-sequence-master")) { + } else if (foType == FObjectNames.PAGE_SEQUENCE_MASTER) { //System.out.println("Found page-sequence-master"); try { foPageSeq = 1.1.2.11 +17 -31 xml-fop/src/org/apache/fop/fo/pagination/Attic/FoPageSequenceMaster.java Index: FoPageSequenceMaster.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Attic/FoPageSequenceMaster.java,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- FoPageSequenceMaster.java 24 Oct 2002 14:58:14 -0000 1.1.2.10 +++ FoPageSequenceMaster.java 28 Oct 2002 00:08:11 -0000 1.1.2.11 @@ -43,28 +43,17 @@ private static final String revision = "$Revision$"; /** - * An array with <tt>UriLocalName</tt> objects identifying + * An array with <tt>int</tt>s identifying * <tt>single-page-master-reference</tt>, * <tt>repeatable-page-master-reference</tt> and * <tt>repeatable-page-master-alternatives</tt> XML events. */ - private static final UriLocalName[] singleOrRepeatableMasterRefs = { - new UriLocalName - (XMLNamespaces.XSLNSpaceIndex, "single-page-master-reference"), - new UriLocalName - (XMLNamespaces.XSLNSpaceIndex, "repeatable-page-master-reference"), - new UriLocalName - (XMLNamespaces.XSLNSpaceIndex, "repeatable-page-master-alternatives") + private static final int[] singleOrRepeatableMasterRefs = { + FObjectNames.SINGLE_PAGE_MASTER_REFERENCE, + FObjectNames.REPEATABLE_PAGE_MASTER_REFERENCE, + FObjectNames.REPEATABLE_PAGE_MASTER_ALTERNATIVES }; - /** - * A <tt>UriLocalName</tt> object identifying a - * <tt>conditional-page-master-reference</tt>, - */ - private static final UriLocalName conditionalPageMasterRef = - new UriLocalName(XMLNamespaces.XSLNSpaceIndex, - "conditional-page-master-reference"); - private String masterName; //private ArrayList subSequenceList = new ArrayList(1); @@ -80,21 +69,21 @@ FoXMLEvent ev = xmlevents.expectStartElement (singleOrRepeatableMasterRefs, XMLEvent.DISCARD_W_SPACE); if (ev == null) break; // page-sequence-masters exhausted - String localName = ev.getLocalName(); - if (localName.equals("single-page-master-reference")) { + int foType = ev.getFoType(); + if (foType == FObjectNames.SINGLE_PAGE_MASTER_REFERENCE) { //System.out.println("Found single-page-master-reference"); //subSequenceList.add(new FoSinglePageMasterReference //(foTree, this, ev)); new FoSinglePageMasterReference(foTree, this, ev); - } else if (localName.equals - ("repeatable-page-master-reference")) { + } else if (foType == + FObjectNames.REPEATABLE_PAGE_MASTER_REFERENCE) { //System.out.println // ("Found repeatable-page-master-reference"); //subSequenceList.add(new FoRepeatablePageMasterReference //(foTree, this, ev)); new FoRepeatablePageMasterReference(foTree, this, ev); - } else if (localName.equals - ("repeatable-page-master-alternatives")) { + } else if (foType == + FObjectNames.REPEATABLE_PAGE_MASTER_ALTERNATIVES) { //System.out.println // ("Found repeatable-page-master-alternatives"); //subSequenceList.add(new FoRepeatablePageMasterAlternatives @@ -191,17 +180,16 @@ try { do { FoXMLEvent ev = this.xmlevents.expectStartElement - (conditionalPageMasterRef.uriIndex, - conditionalPageMasterRef.localName, - XMLEvent.DISCARD_W_SPACE); - if (ev == null) break; // Sun-sequences exhausted + (FObjectNames.CONDITIONAL_PAGE_MASTER_REFERENCE, + XMLEvent.DISCARD_W_SPACE); + if (ev == null) break; // Sub-sequences exhausted //System.out.println // ("Found conditional-page-master-reference"); new FoConditionalPageMasterReference(foTree, this, ev); this.xmlevents.getEndElement(ev); } while (true); } catch (NoSuchElementException e) { - // Enf of file reached + // End of file reached throw new FOPException("EOF in repeatable-page-masters."); } XMLEvent ev = this.xmlevents.getEndElement(event); @@ -221,7 +209,6 @@ parent, event, FOPropertySets.SEQ_MASTER_SET); } - /* public PropertyValue getMasterReference() throws PropertyException { return this.getPropertyValue(PropNames.MASTER_REFERENCE); @@ -239,7 +226,6 @@ { return this.getPropertyValue(PropNames.BLANK_OR_NOT_BLANK); } - */ } // FoConditionalPageMasterReference 1.1.2.8 +10 -2 xml-fop/src/org/apache/fop/fo/pagination/Attic/FoSimplePageMaster.java Index: FoSimplePageMaster.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Attic/FoSimplePageMaster.java,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- FoSimplePageMaster.java 24 Oct 2002 14:58:14 -0000 1.1.2.7 +++ FoSimplePageMaster.java 28 Oct 2002 00:08:11 -0000 1.1.2.8 @@ -12,6 +12,7 @@ // FOP import org.apache.fop.fo.FOAttributes; import org.apache.fop.fo.PropNames; +import org.apache.fop.xml.XMLEvent; import org.apache.fop.xml.FoXMLEvent; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FOPropertySets; @@ -43,6 +44,13 @@ super(foTree, FObjectNames.SIMPLE_PAGE_MASTER, parent, event, FOPropertySets.LAYOUT_SET); // Process regions here + FoXMLEvent regionEv; + if ((regionEv = xmlevents.expectStartElement + (FObjectNames.REGION_BODY, XMLEvent.DISCARD_W_SPACE)) == null) + throw new FOPException + ("No fo:region-body in simple-page-master: " + + getMasterName()); + FoXMLEvent ev = xmlevents.getEndElement(event); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]