pbwest 2002/10/08 23:00:49 Modified: src/org/apache/fop/fo/pagination Tag: FOP_0-20-0_Alt-Design FoLayoutMasterSet.java FoPageSequenceMaster.java Log: Use array argument for multiple choice expectStartElement() calls. Revision Changes Path No revision No revision 1.1.2.6 +20 -10 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.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- FoLayoutMasterSet.java 6 Oct 2002 14:18:05 -0000 1.1.2.5 +++ FoLayoutMasterSet.java 9 Oct 2002 06:00:49 -0000 1.1.2.6 @@ -11,6 +11,7 @@ import org.apache.fop.fo.FOTree; import org.apache.fop.fo.FONode; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.xml.XMLEvent; import org.apache.fop.xml.XMLNamespaces; import org.apache.fop.xml.SyncedXmlEventsBuffer; import org.apache.fop.datastructs.Tree; @@ -37,6 +38,18 @@ private static final String revision = "$Revision$"; /** + * An array with <tt>XMLEvent.UriLocalName</tt> objects identifying + * <tt>simple-page-master</tt> and <tt>page-sequence-master</tt> + * XML events. + */ + private static final XMLEvent.UriLocalName[] simpleOrSequenceMaster = { + new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, "simple-page-master"), + new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, "page-sequence-master") + }; + + /** * Hash of SimplePageMaster and PageSequenceMaster objects, * indexed by master-name of the object. */ @@ -68,19 +81,16 @@ * (simple-page-master|page-sequence-master)+ */ public void setupPageMasters() throws FOPException { - // Set up a list with the two possibilities - LinkedList list = new LinkedList(); - list.add((Object)(new XMLEvent.UriLocalName - (XMLNamespaces.XSLNSpaceIndex, "simple-page-master"))); - list.add((Object)(new XMLEvent.UriLocalName - (XMLNamespaces.XSLNSpaceIndex, "page-sequence-master"))); + // Use an array with the two possibilities try { do { FoSimplePageMaster simple; String simpleName; String localName; FoPageSequenceMaster pageSeq; - XMLEvent ev = xmlevents.expectStartElement(list); + XMLEvent ev = + xmlevents.expectStartElement + (simpleOrSequenceMaster, XMLEvent.DISCARD_W_SPACE); localName = ev.getLocalName(); if (localName.equals("simple-page-master")) { System.out.println("Found simple-page-master"); 1.1.2.6 +21 -13 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.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- FoPageSequenceMaster.java 6 Oct 2002 14:15:11 -0000 1.1.2.5 +++ FoPageSequenceMaster.java 9 Oct 2002 06:00:49 -0000 1.1.2.6 @@ -28,6 +28,7 @@ import org.apache.fop.datastructs.Tree; import org.apache.fop.datatypes.PropertyValue; import org.apache.fop.datatypes.NCName; +import org.apache.fop.xml.XMLEvent; /** * Implements the fo:page-sequence-master flow object. These Fos are @@ -41,6 +42,22 @@ private static final String tag = "$Name$"; private static final String revision = "$Revision$"; + /** + * An array with <tt>XMLEvent.UriLocalName</tt> objects 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 XMLEvent.UriLocalName[] + singleOrRepeatableMasterRefs = { + new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, "single-page-master-reference"), + new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, "repeatable-page-master-reference"), + new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, "repeatable-page-master-alternatives") + }; + private String masterName; private ArrayList subSequenceList = new ArrayList(1); @@ -59,19 +76,10 @@ ("master-name property not an NCName."); masterName = ((NCName)name).getNCName(); // Process sequence members here - LinkedList list = new LinkedList(); - list.add((Object)(new XMLEvent.UriLocalName - (XMLNamespaces.XSLNSpaceIndex, "single-page-master-reference"))); - list.add((Object)(new XMLEvent.UriLocalName - (XMLNamespaces.XSLNSpaceIndex, - "repeatable-page-master-reference"))); - list.add((Object) - (new XMLEvent.UriLocalName - (XMLNamespaces.XSLNSpaceIndex, - "repeatable-page-master-alternatives"))); try { do { - XMLEvent ev = xmlevents.expectStartElement(list); + XMLEvent ev = xmlevents.expectStartElement + (singleOrRepeatableMasterRefs, XMLEvent.DISCARD_W_SPACE); String localName = ev.getLocalName(); if (localName.equals("single-page-master-reference")) { System.out.println("Found single-page-master-reference");
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]