You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by pb...@apache.org on 2004/01/20 06:45:55 UTC
cvs commit: xml-fop/src/java/org/apache/fop/fo FOTree.java FoRoot.java FONode.java
pbwest 2004/01/19 21:45:55
Modified: src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
Driver.java
src/java/org/apache/fop/fo/pagination Tag:
FOP_0-20-0_Alt-Design FoSimplePageMaster.java
FoLayoutMasterSet.java FoPageSequenceMaster.java
src/java/org/apache/fop/pool Tag: FOP_0-20-0_Alt-Design
FopPool.java
src/java/org/apache/fop/datastructs Tag:
FOP_0-20-0_Alt-Design SyncedCircularBuffer.java
src/java/org/apache/fop/xml Tag: FOP_0-20-0_Alt-Design
ArrayXmlEventsBuffer.java
SyncedXmlEventsBuffer.java Namespaces.java
src/java/org/apache/fop/fo/declarations Tag:
FOP_0-20-0_Alt-Design FoDeclarations.java
src/java/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design
FOTree.java FoRoot.java FONode.java
Added: src/java/org/apache/fop/xml Tag: FOP_0-20-0_Alt-Design
XmlEventReader.java
Log:
Changes involved in introducing XmlEventReader, with
configurable XmlEventSources
Revision Changes Path
No revision
No revision
1.9.2.8 +21 -15 xml-fop/src/java/org/apache/fop/apps/Driver.java
Index: Driver.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v
retrieving revision 1.9.2.7
retrieving revision 1.9.2.8
diff -u -r1.9.2.7 -r1.9.2.8
--- Driver.java 15 Jan 2004 02:00:19 -0000 1.9.2.7
+++ Driver.java 20 Jan 2004 05:45:54 -0000 1.9.2.8
@@ -7,10 +7,10 @@
*
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without modifica-
+ * Redistribution and use in saxSource and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
- * 1. Redistributions of source code must retain the above copyright notice,
+ * 1. Redistributions of saxSource code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
@@ -63,7 +63,9 @@
import org.apache.fop.messaging.MessageHandler;
import org.apache.fop.version.Version;
import org.apache.fop.xml.FoXmlSerialHandler;
+import org.apache.fop.xml.Namespaces;
import org.apache.fop.xml.SyncedXmlEventsBuffer;
+import org.apache.fop.xml.XmlEventReader;
/**
* Sets up and runs serialized component threads.
@@ -78,10 +80,12 @@
private InputHandler inputHandler;
private XMLReader parser;
- private InputSource source;
+ private InputSource saxSource;
private FoXmlSerialHandler xmlhandler;
- private SyncedXmlEventsBuffer xmlevents;
+ private SyncedXmlEventsBuffer eventsBuffer;
+ private Namespaces namespaces;
+ private XmlEventReader eventReader;
private FOTree foTree;
private AreaTree areaTree = new AreaTree();
@@ -105,18 +109,18 @@
/**
* Sets up the environment and start processing threads.
* The primary elements of the environment include:<br>
- * the input source, the parser, the
+ * the input saxSource, the parser, the
* {@link org.apache.fop.xml.SyncedXmlEventsBuffer SyncedXmlEventsBuffer}
- * (<code>xmlevents</code>), the
+ * (<code>eventsBuffer</code>), the
* {@link org.apache.fop.xml.FoXmlSerialHandler FoXmlSerialHandler}
* (<code>xmlhandler</code>) and the
* {@link org.apache.fop.fo.FOTree FOTree} (<code>foTree</code>).
*
- * <p>The <code>xmlhandler</code> uses the source and the parser to
- * generate XML events which it stores in <code>xmlevents</code>.
+ * <p>The <code>xmlhandler</code> uses the saxSource and the parser to
+ * generate XML events which it stores in <code>eventsBuffer</code>.
* <code>FoXmlSerialHandler</code> implements <code>Runnable</code>.
*
- * <p>The <code>foTree</code> reads events from the <code>xmlevents</code>
+ * <p>The <code>foTree</code> reads events from the <code>eventsBuffer</code>
* buffer, which it interprets to build the FO tree. <code>FOTree</code>
* implements <code>Runnable</code>.
*
@@ -126,7 +130,7 @@
* buffer has emptied.
* <p>
* The FO Tree builder thread is passed the runnable <code>foTree</code>,
- * which blocks on an empty <code>xmlevents</code> buffer, and continues
+ * which blocks on an empty <code>eventsBuffer</code> buffer, and continues
* when notified that events are available in the buffer.
*
* @throws FOPException
@@ -134,13 +138,15 @@
public void run () throws FOPException {
setInputHandler(Options.getInputHandler());
parser = inputHandler.getParser();
- source = inputHandler.getInputSource();
+ saxSource = inputHandler.getInputSource();
// Setting of namespace-prefixes feature no longer required
//setParserFeatures(parser);
- xmlevents = new SyncedXmlEventsBuffer();
- xmlhandler = new FoXmlSerialHandler(xmlevents, parser, source);
- foTree = new FOTree(xmlevents);
+ namespaces = new Namespaces();
+ eventsBuffer = new SyncedXmlEventsBuffer(namespaces);
+ eventReader = new XmlEventReader(eventsBuffer, namespaces);
+ xmlhandler = new FoXmlSerialHandler(eventsBuffer, parser, saxSource);
+ foTree = new FOTree(eventReader);
driverThread = Thread.currentThread();
foThread = new Thread(foTree, "FOTreeBuilder");
No revision
No revision
1.1.2.5 +13 -13 xml-fop/src/java/org/apache/fop/fo/pagination/Attic/FoSimplePageMaster.java
Index: FoSimplePageMaster.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Attic/FoSimplePageMaster.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- FoSimplePageMaster.java 15 Jan 2004 03:01:53 -0000 1.1.2.4
+++ FoSimplePageMaster.java 20 Jan 2004 05:45:54 -0000 1.1.2.5
@@ -67,7 +67,7 @@
import org.apache.fop.fo.PropNames;
import org.apache.fop.fo.PropertySets;
import org.apache.fop.fo.expr.PropertyException;
-import org.apache.fop.xml.SyncedXmlEventsBuffer;
+import org.apache.fop.xml.XmlEventReader;
import org.apache.fop.xml.XmlEvent;
/**
@@ -146,8 +146,8 @@
// Process region-body
regionBody = new FoRegionBody(foTree, this, regionEv);
regionEv = xmlevents.getEndElement
- (SyncedXmlEventsBuffer.DISCARD_EV, regionEv);
- namespaces.surrenderEvent(regionEv);
+ (XmlEventReader.DISCARD_EV, regionEv);
+ namespaces.relinquishEvent(regionEv);
// Remaining regions are optional
if ((regionEv = xmlevents.expectStartElement
@@ -156,8 +156,8 @@
{
regionBefore = new FoRegionBefore(foTree, this, regionEv);
regionEv = xmlevents.getEndElement
- (SyncedXmlEventsBuffer.DISCARD_EV, regionEv);
- namespaces.surrenderEvent(regionEv);
+ (XmlEventReader.DISCARD_EV, regionEv);
+ namespaces.relinquishEvent(regionEv);
}
if ((regionEv = xmlevents.expectStartElement
@@ -166,8 +166,8 @@
{
regionAfter = new FoRegionAfter(foTree, this, regionEv);
regionEv = xmlevents.getEndElement
- (SyncedXmlEventsBuffer.DISCARD_EV, regionEv);
- namespaces.surrenderEvent(regionEv);
+ (XmlEventReader.DISCARD_EV, regionEv);
+ namespaces.relinquishEvent(regionEv);
}
if ((regionEv = xmlevents.expectStartElement
@@ -176,8 +176,8 @@
{
regionStart = new FoRegionStart(foTree, this, regionEv);
regionEv = xmlevents.getEndElement
- (SyncedXmlEventsBuffer.DISCARD_EV, regionEv);
- namespaces.surrenderEvent(regionEv);
+ (XmlEventReader.DISCARD_EV, regionEv);
+ namespaces.relinquishEvent(regionEv);
}
if ((regionEv = xmlevents.expectStartElement
@@ -186,8 +186,8 @@
{
regionEnd = new FoRegionEnd(foTree, this, regionEv);
regionEv = xmlevents.getEndElement
- (SyncedXmlEventsBuffer.DISCARD_EV, regionEv);
- namespaces.surrenderEvent(regionEv);
+ (XmlEventReader.DISCARD_EV, regionEv);
+ namespaces.relinquishEvent(regionEv);
}
// Clean up the build environment
1.1.2.6 +6 -6 xml-fop/src/java/org/apache/fop/fo/pagination/Attic/FoLayoutMasterSet.java
Index: FoLayoutMasterSet.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/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 15 Jan 2004 03:01:53 -0000 1.1.2.5
+++ FoLayoutMasterSet.java 20 Jan 2004 05:45:54 -0000 1.1.2.6
@@ -67,7 +67,7 @@
import org.apache.fop.fo.FObjectNames;
import org.apache.fop.fo.PropNames;
import org.apache.fop.fo.expr.PropertyException;
-import org.apache.fop.xml.SyncedXmlEventsBuffer;
+import org.apache.fop.xml.XmlEventReader;
import org.apache.fop.xml.XmlEvent;
/**
@@ -214,8 +214,8 @@
throw new FOPException
("Error seeking page-masters");
// Flush the master event
- ev = xmlevents.getEndElement(SyncedXmlEventsBuffer.DISCARD_EV, ev);
- namespaces.surrenderEvent(ev);
+ ev = xmlevents.getEndElement(XmlEventReader.DISCARD_EV, ev);
+ namespaces.relinquishEvent(ev);
} while (true);
} catch (NoSuchElementException e) {
// Unexpected end of file
1.1.2.6 +7 -7 xml-fop/src/java/org/apache/fop/fo/pagination/Attic/FoPageSequenceMaster.java
Index: FoPageSequenceMaster.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/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 15 Jan 2004 03:01:53 -0000 1.1.2.5
+++ FoPageSequenceMaster.java 20 Jan 2004 05:45:54 -0000 1.1.2.6
@@ -67,7 +67,7 @@
import org.apache.fop.fo.FObjectNames;
import org.apache.fop.fo.PropNames;
import org.apache.fop.fo.expr.PropertyException;
-import org.apache.fop.xml.SyncedXmlEventsBuffer;
+import org.apache.fop.xml.XmlEventReader;
import org.apache.fop.xml.XmlEvent;
/**
@@ -252,8 +252,8 @@
throw new FOPException
("Aargh! expectStartElement(events, list)");
ev = xmlevents.getEndElement
- (SyncedXmlEventsBuffer.DISCARD_EV, ev);
- namespaces.surrenderEvent(ev);
+ (XmlEventReader.DISCARD_EV, ev);
+ namespaces.relinquishEvent(ev);
} while (true);
} catch (NoSuchElementException e) {
throw new FOPException("Unexpected EOF in page-sequence-master.");
@@ -343,8 +343,8 @@
// ("Found conditional-page-master-reference");
new FoConditionalPageMasterReference(foTree, this, ev);
ev = this.xmlevents.getEndElement
- (SyncedXmlEventsBuffer.DISCARD_EV, ev);
- this.namespaces.surrenderEvent(ev);
+ (XmlEventReader.DISCARD_EV, ev);
+ this.namespaces.relinquishEvent(ev);
} while (true);
} catch (NoSuchElementException e) {
// End of file reached
No revision
No revision
1.1.2.2 +5 -8 xml-fop/src/java/org/apache/fop/pool/Attic/FopPool.java
Index: FopPool.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pool/Attic/FopPool.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- FopPool.java 14 Jan 2004 15:39:23 -0000 1.1.2.1
+++ FopPool.java 20 Jan 2004 05:45:54 -0000 1.1.2.2
@@ -79,7 +79,7 @@
* the range of values that the <tt>Poolable</tt> <i>id</i> field can
* assume.
* If there is a significant disparity between the frequency of
- * pool acquire and surrender invocations, an id clash may arise in
+ * pool acquire and relinquish invocations, an id clash may arise in
* the current set.
*/
protected final BitSet eventSet;
@@ -119,12 +119,9 @@
* Return an <tt>Poolable</tt> to the pool.
* @param ev - the event being returned.
*/
- public synchronized void surrenderPoolable(Poolable ev) {
- //System.out.println("surrenderEvent " + ev.id
- //+ " poolSize " + poolSize);
+ public synchronized void relinquishPoolable(Poolable ev) {
if (ev == null) return;
if (eventSet.get(ev.id)) {
- //System.out.println("Event clash: " + ev);
MessageHandler.logln
("Event clash in Poolable pool. Id " + ev.id);
return;
No revision
No revision
1.1.2.5 +3 -5 xml-fop/src/java/org/apache/fop/datastructs/Attic/SyncedCircularBuffer.java
Index: SyncedCircularBuffer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datastructs/Attic/SyncedCircularBuffer.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- SyncedCircularBuffer.java 17 Jan 2004 00:16:10 -0000 1.1.2.4
+++ SyncedCircularBuffer.java 20 Jan 2004 05:45:54 -0000 1.1.2.5
@@ -53,7 +53,6 @@
package org.apache.fop.datastructs;
import java.util.NoSuchElementException;
-import java.lang.IndexOutOfBoundsException;
/**
* A general synchronized circular buffer class.
@@ -124,8 +123,7 @@
* <p>This implementation supports a single entry pushback buffer.</p>
* @param obj and <tt>Object</tt>
*/
- synchronized public void pushBack (Object obj)
- throws IndexOutOfBoundsException {
+ synchronized public void pushBack (Object obj) {
if (pushBackBuf != null)
throw new IndexOutOfBoundsException("pushBack buffer is full");
pushBackBuf = obj;
No revision
No revision
1.1.2.2 +5 -2 xml-fop/src/java/org/apache/fop/xml/Attic/ArrayXmlEventsBuffer.java
Index: ArrayXmlEventsBuffer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/xml/Attic/ArrayXmlEventsBuffer.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ArrayXmlEventsBuffer.java 19 Jan 2004 07:12:01 -0000 1.1.2.1
+++ ArrayXmlEventsBuffer.java 20 Jan 2004 05:45:54 -0000 1.1.2.2
@@ -153,6 +153,9 @@
// TODO Should check for legality of this operation - this will involve
// a change to the SyncedXmlEventsBuffer implementation and the
// XmlEventSource interface.
+ if (nextEvent <= 0) {
+ throw new IndexOutOfBoundsException("No events read from buffer");
+ }
nextEvent--;
}
1.1.2.6 +13 -1162 xml-fop/src/java/org/apache/fop/xml/Attic/SyncedXmlEventsBuffer.java
Index: SyncedXmlEventsBuffer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/xml/Attic/SyncedXmlEventsBuffer.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- SyncedXmlEventsBuffer.java 19 Jan 2004 07:09:19 -0000 1.1.2.5
+++ SyncedXmlEventsBuffer.java 20 Jan 2004 05:45:54 -0000 1.1.2.6
@@ -51,15 +51,8 @@
*/
package org.apache.fop.xml;
-import java.util.BitSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.NoSuchElementException;
-
import org.apache.fop.apps.FOPException;
import org.apache.fop.datastructs.SyncedCircularBuffer;
-import org.apache.fop.fo.FObjectNames;
-import org.apache.fop.fo.FObjectSets;
/**
* A synchronized circular buffer for XMLEvents.
@@ -75,40 +68,36 @@
implements XmlEventSource {
/**
- * Constant for <i>discardEvent</i> field of
- * <i>getEndElement(boolean discardEvent, XmlEvent(, boolean)).
- */
- public static final boolean DISCARD_EV = true,
- RETAIN_EV = false;
-
- /**
* Maintains an index of namespace URIs. These can then be referred to
* by an <tt>int</tt> index.
*/
private Namespaces namespaces;
/**
- * No-argument constructor sets up a buffer with the default number of
- * elements.
+ * One-argument constructor sets up a buffer with the default number of
+ * elements and the "global" <code>Namespaces</code> object.
* The producer and consumer <tt>Thread</tt>s default to the current
* thread at the time of instantiation.
+ * @param namespaces object for this <code>Driver</code> instance
+ * @throws IllegalArgumentException
*/
- public SyncedXmlEventsBuffer()
+ public SyncedXmlEventsBuffer(Namespaces namespaces)
throws IllegalArgumentException
{
- super();
- namespaces = new Namespaces();
+ this.namespaces = namespaces;
}
/**
- * Constructor taking one argument; the size of the buffer.
+ * Constructs a buffer with <code>size</code> elements and the "global"
+ * <code>Namespaces</code> object.
+ * @param namespaces object for this <code>Driver</code> instance
* @param size the size of the buffer. Must be > 1.
*/
- public SyncedXmlEventsBuffer(int size)
+ public SyncedXmlEventsBuffer(Namespaces namespaces, int size)
throws IllegalArgumentException
{
super(size);
- namespaces = new Namespaces();
+ this.namespaces = namespaces;
}
/**
@@ -142,1144 +131,6 @@
*/
public void pushBack (XmlEvent event) {
super.pushBack(event);
- }
-
- /**
- * Get the next event of the given type from the buffer. Discard
- * intervening events.
- * @param eventType - the <tt>int</tt> event type.
- * @return an event of the given type.
- * @exception FOPException if buffer errors or interrupts occur.
- * @exception NoSuchElementException if the event is not found.
- */
- public XmlEvent getSaxEvent(int eventType) throws FOPException {
- XmlEvent ev = getEvent();
- while (ev != null && ev.type != eventType) {
- ev = getEvent();
- }
- if (ev == null) {
- throw new NoSuchElementException
- (XmlEvent.eventTypeName(eventType) + " not found.");
- }
- return ev;
- }
-
- /**
- * Get the next event of the given type and with the given <tt>QName</tt>
- * from the buffer. Discard intervening events.
- * @param eventType - the <tt>int</tt> event type.
- * @param qName a <tt>String</tt> with the <tt>QName</tt> of the
- * required element.
- * @return an event of the given type.
- * @exception FOPException if buffer errors or interrupts occur.
- * @exception NoSuchElementException if the event is not found.
- */
- public XmlEvent getSaxQNameEvent(int eventType, String qName)
- throws FOPException
- {
- XmlEvent ev = getEvent();
- while (ev != null &&
- ! (ev.type == eventType && ev.qName.equals(qName))) {
- ev = getEvent();
- }
- if (ev == null) {
- throw new NoSuchElementException
- (XmlEvent.eventTypeName(eventType) + " " + qName + " not found.");
- }
- return ev;
- }
-
- /**
- * Get the next event of the given SAX type, from the given namespace
- * (<code>uriIndex</code>) with the given local name, from the buffer.
- * Discard intervening events.
- * @param eventType the SAX event type.
- * @param uriIndex the URI index maintained in the
- * <tt>Namespaces</tt> object.
- * @param localName of the required element.
- * @return an event of the given type.
- * @exception FOPException if buffer errors or interrupts occur.
- * @exception NoSuchElementException if the event is not found.
- */
- public XmlEvent getSaxUriLocalEvent
- (int eventType, int uriIndex, String localName)
- throws FOPException
- {
- XmlEvent ev = getEvent();
- while (ev != null &&
- ! (ev.type == eventType
- && ev.uriIndex == uriIndex
- && ev.localName.equals(localName))) {
- namespaces.surrenderEvent(ev);
- ev = getEvent();
- }
- if (ev == null)
- throw new NoSuchElementException
- (XmlEvent.eventTypeName(eventType)
- + namespaces.getIndexURI(uriIndex)
- + ":" + localName + " not found.");
- return ev;
- }
-
- /**
- * Get the next event with of the given SAX type, whose URI is matched
- * by the namespaces URI indexed by <code>uriIndex</code>, and whose
- * namespace-specific type matches <code>nsType</code>.
- * Discard any intervening events.
- * @param eventType the SAX event type
- * @param uriIndex of the URI in namespaces
- * @param nsType the namespace-specific type
- * @return the matching event
- * @throws FOPException
- */
- public XmlEvent getSaxUriTypedEvent(
- int eventType, int uriIndex, int nsType) throws FOPException {
- XmlEvent ev = getEvent();
- while (ev != null) {
- if (ev.type == eventType && ev.uriIndex == uriIndex) {
- switch (uriIndex) {
- case Namespaces.DefAttrNSIndex:
- throw new NoSuchElementException
- ("No special types for default attribute namespace");
- case Namespaces.XSLNSpaceIndex:
- // The FO namespace
- if (ev.getFoType() == nsType) {
- return ev;
- }
- break;
- case Namespaces.FOXNSpaceIndex:
- // The FOX namespace
- if (ev.getFoxType() == nsType) {
- return ev;
- }
- break;
- case Namespaces.SVGNSpaceIndex:
- // The SVG namespace
- if (ev.getSvgType() == nsType) {
- return ev;
- }
- break;
- }
- }
- namespaces.surrenderEvent(ev);
- ev = getEvent();
- }
- throw new NoSuchElementException
- (XmlEvent.eventTypeName(eventType) + " "
- + namespaces.getIndexURI(uriIndex)
- + " type " + nsType + " not found.");
- }
-
- /**
- * Get the next event of the given type, from the fo: namespace, with
- * the given FO type. Discard intervening events.
- * @param eventType - the <tt>int</tt> event type.
- * @param foType - the <tt>int</tt> FO type.
- * @return an event of the given type.
- * @exception FOPException if buffer errors or interrupts occur.
- * @exception NoSuchElementException if the event is not found.
- */
- public XmlEvent getSaxFoEvent(int eventType, int foType)
- throws FOPException
- {
- return getSaxUriTypedEvent(
- eventType, Namespaces.XSLNSpaceIndex, foType);
- }
-
- /**
- * Return the next element if it is of the required type. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param eventType - the <tt>int</tt> event type.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return an event of the required type. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur.
- * @exception NoSuchElementException if the buffer is empty.
- */
- public XmlEvent expectSaxEvent
- (int eventType, boolean discardWhiteSpace)
- throws FOPException
- {
- XmlEvent ev = getEvent();
- if (discardWhiteSpace) {
- while (ev != null && ev.type == XmlEvent.CHARACTERS
- && ev.chars.trim().equals("")) {
- namespaces.surrenderEvent(ev);
- ev = getEvent();
- }
- }
- if (ev != null && ev.type == eventType) {
- return ev;
- }
- if (ev == null)
- throw new NoSuchElementException
- (XmlEvent.eventTypeName(eventType)
- + " not found: end of buffer.");
- pushBack(ev);
- return null;
- }
-
- /**
- * Return the next element if it is of the required type and has the
- * required URI index and local name. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param eventType - the <tt>int</tt> event type.
- * @param uriIndex - the <tt>int</tt> URI index.
- * @param localName a <tt>String</tt> with the local name of the
- * required element.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return an event of the required type. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur.
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectSaxUriLocalEvent
- (int eventType, int uriIndex,
- String localName, boolean discardWhiteSpace)
- throws FOPException
- {
- XmlEvent ev = getEvent();
- if (discardWhiteSpace) {
- while (ev != null && ev.type == XmlEvent.CHARACTERS
- && ev.chars.trim().equals("")) {
- namespaces.surrenderEvent(ev);
- ev = getEvent();
- }
- }
- if (ev != null
- && ev.type == eventType
- && ev.uriIndex == uriIndex
- && ev.localName.equals(localName)) {
- return ev;
- }
- if (ev == null)
- throw new NoSuchElementException
- (XmlEvent.eventTypeName(eventType)
- + " not found: end of buffer.");
- pushBack(ev);
- return null;
- }
-
- /**
- * Return the next event if it is of the given SAX type, whose URI is
- * matched by the namespaces URI indexed by <code>uriIndex</code>, and
- * whose namespace-specific type matches <code>nsType</code>.
- * If the next element is not of the required type,
- * push it back onto the buffer.
- * @param eventType the SAX event type
- * @param uriIndex of the URI in namespaces
- * @param nsType the namespace-specific type
- * @param discardWhiteSpace - if true, discard any intervening
- * <tt>characters</tt> events which contain only whitespace.
- * @return an event of the required type. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @throws FOPException
- */
- public XmlEvent expectSaxUriTypedEvent(
- int eventType, int uriIndex, int nsType,
- boolean discardWhiteSpace)
- throws FOPException {
- XmlEvent ev = getEvent();
- if (discardWhiteSpace) {
- while (ev != null && ev.type == XmlEvent.CHARACTERS
- && ev.chars.trim().equals("")) {
- namespaces.surrenderEvent(ev);
- ev = getEvent();
- }
- }
- if (ev != null && ev.type == eventType) {
- switch (uriIndex) {
- case Namespaces.DefAttrNSIndex:
- throw new NoSuchElementException
- ("No special types for default attribute namespace");
- case Namespaces.XSLNSpaceIndex:
- // The FO namespace
- if (ev.getFoType() == nsType) {
- return ev;
- }
- break;
- case Namespaces.FOXNSpaceIndex:
- // The FOX namespace
- if (ev.getFoxType() == nsType) {
- return ev;
- }
- break;
- case Namespaces.SVGNSpaceIndex:
- // The SVG namespace
- if (ev.getSvgType() == nsType) {
- return ev;
- }
- break;
- }
- }
- if (ev == null)
- throw new NoSuchElementException
- (XmlEvent.eventTypeName(eventType) + " "
- + namespaces.getIndexURI(uriIndex)
- + " type " + nsType + " not found.");
- pushBack(ev);
- return null;
- }
-
- /**
- * Return the next element if it is of the required type and has the
- * required FO type. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param eventType - the <tt>int</tt> event type.
- * @param foType - the <tt>int</tt> FO type.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return an event of the required type. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur.
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectSaxFoEvent
- (int eventType, int foType, boolean discardWhiteSpace)
- throws FOPException
- {
- return expectSaxUriTypedEvent(
- eventType, Namespaces.XSLNSpaceIndex,
- foType, discardWhiteSpace);
- }
-
- /**
- * Get the next ENDDOCUMENT event from the buffer. Discard any other
- * events preceding the ENDDOCUMENT event.
- * @return an ENDDOCUMENT event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getEndDocument() throws FOPException {
- return getSaxEvent(XmlEvent.ENDDOCUMENT);
- }
-
- /**
- * Return the next element if it is an ENDDOCUMENT. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return an ENDDOCUMENT event. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectEndDocument(boolean discardWhiteSpace)
- throws FOPException
- {
- return expectSaxEvent(XmlEvent.ENDDOCUMENT, discardWhiteSpace);
- }
-
- /**
- * Get the next STARTELEMENT event from the buffer. Discard any other
- * events preceding the STARTELEMENT event.
- * @return a STARTELEMENT event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getStartElement() throws FOPException {
- return getSaxEvent(XmlEvent.STARTELEMENT);
- }
-
- /**
- * Return the next element if it is a STARTELEMENT. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a STARTELEMENT event. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectStartElement(boolean discardWhiteSpace)
- throws FOPException
- {
- return expectSaxEvent(XmlEvent.STARTELEMENT, discardWhiteSpace);
- }
-
- /**
- * Get the next STARTELEMENT event with the given URI index and local name
- * from the buffer. Discard any other events preceding the
- * STARTELEMENT event.
- * @param uriIndex an <tt>int</tt> with the index of the URI of the
- * required URI
- * @param localName a <tt>String</tt> with the local name of the
- * required STARTELEMENT
- * @return a STARTELEMENT event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getStartElement(int uriIndex, String localName)
- throws FOPException
- {
- return getSaxUriLocalEvent(XmlEvent.STARTELEMENT, uriIndex, localName);
- }
-
- /**
- * Return the next element if it is a STARTELEMENT with the given
- * URI index and local name. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param uriIndex an <tt>int</tt> URI index.
- * @param localName a <tt>String</tt> with the local name of the
- * required STARTELEMENT
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a STARTELEMENT event. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectStartElement
- (int uriIndex, String localName, boolean discardWhiteSpace)
- throws FOPException
- {
- return expectSaxUriLocalEvent
- (XmlEvent.STARTELEMENT, uriIndex, localName, discardWhiteSpace);
- }
-
- /**
- * Get the next STARTELEMENT event with the given URI index and local name
- * from the buffer. Discard any other events preceding the
- * STARTELEMENT event.
- * @param uriIndex an <tt>int</tt> with the index of the URI of the
- * required URI
- * @param nsType the namespace-dependent event type
- * @return a STARTELEMENT event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getStartElement(int uriIndex, int nsType)
- throws FOPException
- {
- return getSaxUriTypedEvent(XmlEvent.STARTELEMENT, uriIndex, nsType);
- }
-
- /**
- * Return the next element if it is a STARTELEMENT with the given
- * URI index and local name. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param uriIndex an <tt>int</tt> URI index.
- * @param nsType the namespace-dependent event type
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a STARTELEMENT event. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectStartElement(
- int uriIndex, int nsType, boolean discardWhiteSpace)
- throws FOPException
- {
- return expectSaxUriTypedEvent(
- XmlEvent.STARTELEMENT, uriIndex, nsType, discardWhiteSpace);
- }
-
- /**
- * From the buffer get the next STARTELEMENT event from the fo: namespace
- * with the given FO object type.
- * Discard any other events preceding the
- * STARTELEMENT event.
- * @param foType - the <tt>int</tt> FO object type, as defined in
- * <tt>FObjectNames</tt>.
- * @return a matching STARTELEMENT event.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getStartElement(int foType)
- throws FOPException
- {
- return getSaxFoEvent(XmlEvent.STARTELEMENT, foType);
- }
-
- /**
- * From the buffer return the next STARTELEMENT event from the fo:
- * namespace with the given FO object type. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param foType - the <tt>int</tt> FO object type, as defined in
- * <tt>FObjectNames</tt>.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a matching STARTELEMENT event. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectStartElement
- (int foType, boolean discardWhiteSpace)
- throws FOPException
- {
- return expectSaxFoEvent(
- XmlEvent.STARTELEMENT, foType, discardWhiteSpace);
- }
-
- /**
- * Get one of a list of possible STARTELEMENT events.
- * @param list a <tt>LinkedList</tt> containing either <tt>String</tt>s
- * with the <tt>QName</tt>, or <tt>UriLocalName</tt>
- * objects with the URI index and local name of one of the required
- * STARTELEMENT events.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a STARTELEMENT event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getStartElement
- (LinkedList list, boolean discardWhiteSpace)
- throws FOPException
- {
- XmlEvent ev;
- do {
- ev = expectStartElement(list, discardWhiteSpace);
- if (ev != null) return ev;
- // The non-matching event has been pushed back.
- // Get it and discard. Note that if the first attempt to
- // getEvent() returns null, the expectStartElement() calls
- // return null.
- ev = getEvent();
- namespaces.surrenderEvent(ev);
- } while (ev != null);
- // Exit from this while loop is only by discovery of null event
- throw new NoSuchElementException
- ("StartElement from list not found.");
- }
-
- /**
- * Get one of a list of possible STARTELEMENT events.
- * @param list a <tt>LinkedList</tt> containing either
- * <tt>UriLocalName</tt> objects with the URI index and local name,
- * <tt>NameSpaceType</tt> objects with the URI index and local name and
- * a namespace-dependent <tt>int</tt> type, or <tt>Integer</tt>s with
- * the FO type of one of the required STARTELEMENT events.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a STARTELEMENT event. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectStartElement
- (LinkedList list, boolean discardWhiteSpace)
- throws FOPException
- {
- XmlEvent ev;
- Iterator elements = list.iterator();
- while (elements.hasNext()) {
- Object o = elements.next();
- if (o instanceof UriLocalName) {
- if (o instanceof NameSpaceType) {
- NameSpaceType nameSpType = (NameSpaceType)o;
- ev = expectStartElement(
- nameSpType.uriIndex,
- nameSpType.nsType,
- discardWhiteSpace);
- // Found it!
- if (ev != null) return ev;
- } else {
- UriLocalName uriLocalName = (UriLocalName)o;
- ev = expectStartElement
- (uriLocalName.uriIndex,
- uriLocalName.localName,
- discardWhiteSpace);
- // Found it!
- if (ev != null) return ev;
- }
- } else if (o instanceof Integer) {
- ev = expectStartElement(((Integer)o).intValue(),
- discardWhiteSpace);
- if (ev != null) return ev;
- } else
- throw new FOPException
- ("Invalid list elements for getStartElement");
- }
- return null;
- }
-
- /**
- * Get one of a array of possible STARTELEMENT events. Scan and discard
- * events until a STARTELEMENT event is found whose URI index and
- * local name matches one of those in the argument
- * <tt>UriLocalName[]</tt> array.
- * @param list an array containing <tt>UriLocalName</tt>
- * objects with the URI index and local name of
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * STARTELEMENT events, one of which is required.
- * @return the next matching STARTELEMENT event from the buffer.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getStartElement
- (UriLocalName[] list, boolean discardWhiteSpace)
- throws FOPException
- {
- XmlEvent ev;
- do {
- ev = expectStartElement(list, discardWhiteSpace);
- if (ev != null) return ev;
- // The non-matching event has been pushed back.
- // Get it and discard. Note that if the first attempt to
- // getEvent() returns null, the expectStartElement() calls
- // will throw a NoSuchElementException
- ev = getEvent();
- namespaces.surrenderEvent(ev);
- } while (ev != null);
- // Exit from this while loop is only by discovery of null event
- throw new NoSuchElementException
- ("StartElement from list not found.");
- }
-
- /**
- * Expect one of an array of possible STARTELEMENT events. The next
- * STARTELEMENT must have a URI index and local name which match
- * an element of the argument <tt>UriLocalName[]</tt> list.
- * @param list an <tt>UriLocalName[]</tt> array containing the
- * namespace Uri index and LocalName
- * of possible events, one of which must be the next returned.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return the matching STARTELEMENT event. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectStartElement
- (UriLocalName[] list, boolean discardWhiteSpace)
- throws FOPException
- {
- XmlEvent ev;
- for (int i = 0; i < list.length; i++) {
- ev = expectStartElement(list[i].uriIndex,
- list[i].localName,
- discardWhiteSpace);
- // Found it!
- if (ev != null) return ev;
- }
- return null;
- }
-
- /**
- * Get one of a array of possible STARTELEMENT events. Scan and discard
- * events until a STARTELEMENT event is found which is in the fo:
- * namespace and whose FO type matches one of those in the argument
- * <tt>int</tt> array.
- * @param list an <tt>int[]</tt> array containing FO types
- * one of which is required.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return the next matching STARTELEMENT event from the buffer.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getStartElement(int[] list, boolean discardWhiteSpace)
- throws FOPException
- {
- XmlEvent ev;
- do {
- ev = expectStartElement(list, discardWhiteSpace);
- if (ev != null) return ev;
- // The non-matching event has been pushed back.
- // Get it and discard. Note that if the first attempt to
- // getEvent() returns null, the expectStartElement() calls
- // will throw a NoSuchElementException
- ev = getEvent();
- namespaces.surrenderEvent(ev);
- } while (ev != null);
- // Exit from this while loop is only by discovery of null event
- throw new NoSuchElementException
- ("StartElement from array not found.");
- }
-
- /**
- * Expect one of an array of possible STARTELEMENT events. The next
- * STARTELEMENT must be in the fo: namespace, and must have an FO type
- * which matches one of those in the argument <tt>int[]</tt> list.
- * @param list a <tt>int[]</tt> array containing the FO types
- * of possible events, one of which must be the next returned.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return the matching STARTELEMENT event.If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectStartElement
- (int[] list, boolean discardWhiteSpace)
- throws FOPException
- {
- XmlEvent ev;
- for (int i = 0; i < list.length; i++) {
- ev = expectStartElement(list[i], discardWhiteSpace);
- // Found it!
- if (ev != null) return ev;
- }
- return null;
- }
-
- /**
- * Get one of a <tt>BitSet</tt> of possible STARTELEMENT events. Scan
- * and discard events until a STARTELEMENT event is found which is in
- * the fo: namespace and whose FO type matches one of those in the
- * argument <tt>BitSet</tt>.
- * @param set a <tt>BitSet</tt> containing FO types one of which is
- * required.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return the next matching STARTELEMENT event from the buffer.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getStartElement(BitSet set, boolean discardWhiteSpace)
- throws FOPException
- {
- XmlEvent ev;
- do {
- try {
- ev = expectStartElement(set, discardWhiteSpace);
- if (ev != null) return ev;
- // The non-matching event has been pushed back.
- // Get it and discard. Note that if the first attempt to
- // getEvent() returns null, the expectStartElement() calls
- // will throw a NoSuchElementException
- ev = getEvent();
- namespaces.surrenderEvent(ev);
- } catch(UnexpectedStartElementException e) {
- ev = getEvent();
- namespaces.surrenderEvent(ev);
- }
- } while (ev != null);
- // Exit from this while loop is only by discovery of null event
- throw new NoSuchElementException
- ("StartElement from BitSet not found.");
- }
-
- /**
- * Expect one of an <tt>BitSet</tt> of possible STARTELEMENT events.
- * The next STARTELEMENT must be in the fo: namespace, and must have an
- * FO type which matches one of those in the argument <tt>BitSet</tt>.
- * <p>TODO:<br>
- * This method should be retro-fitted to list and array versions.
- *
- * @param set a <tt>BitSet</tt> containing the FO types
- * of possible events, one of which must be the next returned.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return the matching STARTELEMENT event.If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectStartElement
- (BitSet set, boolean discardWhiteSpace)
- throws FOPException, UnexpectedStartElementException
- {
- XmlEvent ev;
- ev = expectSaxEvent(XmlEvent.STARTELEMENT, discardWhiteSpace);
- if (ev == null) return ev;
-
- for (int i = set.nextSetBit(0); i >= 0; i = set.nextSetBit(++i)) {
- if (ev.getFoType() == i)
- return ev; // Found it!
- }
- // Not found - push the STARTELEMENT event back and throw an
- // UnexpectedStartElementException
- pushBack(ev);
- throw new UnexpectedStartElementException
- ("Unexpected START element: " + ev.getQName());
- }
-
- /**
- * Expect that the next element will be a STARTELEMENT for one of the
- * flow objects which are members of %block; from
- * <b>6.2 Formatting Object Content</b>, including out-of-line flow
- * objects which may occur except as descendents of out-of-line formatting
- * objects. White space is discarded.
- * @return the <tt>XmlEvent found. If any other events are encountered
- * return <tt>null</tt>.
- */
- public XmlEvent expectBlock()
- throws FOPException, UnexpectedStartElementException
- {
- return expectStartElement
- (FObjectSets.blockEntity, XmlEvent.DISCARD_W_SPACE);
- }
-
- /**
- * Expect that the next element will be a STARTELEMENT for one of the
- * flow objects which are members of %block; from
- * <b>6.2 Formatting Object Content</b>, excluding out-of-line flow
- * objects which may not occur as descendents of out-of-line formatting
- * objects. White space is discarded.
- * @return the <tt>XmlEvent found. If any other events are encountered
- * return <tt>null</tt>.
- */
- public XmlEvent expectOutOfLineBlock()
- throws FOPException, UnexpectedStartElementException
- {
- return expectStartElement
- (FObjectSets.outOfLineBlockSet, XmlEvent.DISCARD_W_SPACE);
- }
-
- /**
- * Expect that the next element will be a STARTELEMENT for one of the
- * flow objects which are members of (#PCDATA|%inline;) from
- * <b>6.2 Formatting Object Content</b>, including out-of-line flow
- * objects which may occur except as descendents of out-of-line
- * formatting objects. White space is retained, and
- * will appear as #PCDATA, i.e, as an instance of FoCharacters.
- * @return the <tt>XmlEvent found. If any other events are encountered
- * return <tt>null</tt>.
- */
- public XmlEvent expectPcdataOrInline()
- throws FOPException, UnexpectedStartElementException
- {
- XmlEvent ev = expectStartElement
- (FObjectSets.normalPcdataInlineSet, XmlEvent.RETAIN_W_SPACE);
- if (ev == null)
- ev = expectCharacters();
- return ev;
- }
-
- /**
- * Expect that the next element will be a STARTELEMENT for one of the
- * flow objects which are members of (#PCDATA|%inline;) from
- * <b>6.2 Formatting Object Content</b>, excluding out-of-line flow
- * objects which may not occur as descendents of out-of-line formatting
- * objects. White space is retained, and
- * will appear as #PCDATA, i.e, as an instance of FoCharacters.
- * @return the <tt>XmlEvent found. If any other events are encountered
- * return <tt>null</tt>.
- */
- public XmlEvent expectOutOfLinePcdataOrInline()
- throws FOPException, UnexpectedStartElementException
- {
- XmlEvent ev = expectStartElement
- (FObjectSets.inlineEntity, XmlEvent.RETAIN_W_SPACE);
- if (ev == null)
- ev = expectCharacters();
- return ev;
- }
-
- /**
- * Expect that the next element will be a STARTELEMENT for one of the
- * flow objects which are members of (#PCDATA|%inline;|%block;) from
- * <b>6.2 Formatting Object Content</b>, including out-of-line flow
- * objects which may occur except as descendents of out-of-line
- * formatting objects. White space is retained, and
- * will appear as #PCDATA, i.e, as an instance of FoCharacters.
- * @return the <tt>XmlEvent</tt> found. If any other events are
- * encountered return <tt>null</tt>.
- */
- public XmlEvent expectPcdataOrInlineOrBlock()
- throws FOPException, UnexpectedStartElementException
- {
- XmlEvent ev = expectStartElement
- (FObjectSets.normalPcdataBlockInlineSet, XmlEvent.RETAIN_W_SPACE);
- if (ev == null)
- ev = expectCharacters();
- return ev;
- }
-
- /**
- * Expect that the next element will be a STARTELEMENT for one of the
- * flow objects which are members of (#PCDATA|%inline;|%block;) from
- * <b>6.2 Formatting Object Content</b>, excluding out-of-line flow
- * objects which may not occur as descendents of out-of-line formatting
- * objects. White space is retained, and
- * will appear as #PCDATA, i.e, as an instance of FoCharacters.
- * @return the <tt>XmlEvent</tt> found. If any other events are
- * encountered return <tt>null</tt>.
- */
- public XmlEvent expectOutOfLinePcdataOrInlineOrBlock()
- throws FOPException, UnexpectedStartElementException
- {
- XmlEvent ev = expectStartElement
- (FObjectSets.outOfLinePcdataBlockInlineSet,
- XmlEvent.RETAIN_W_SPACE);
- if (ev == null)
- ev = expectCharacters();
- return ev;
- }
-
- /**
- * Get the next ENDELEMENT event from the buffer. Discard any other
- * events preceding the ENDELEMENT event.
- * @return an ENDELEMENT event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getEndElement() throws FOPException {
- return getSaxEvent(XmlEvent.ENDELEMENT);
- }
-
- /**
- * Return the next element if it is an ENDELEMENT. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a matching ENDELEMENT event. If the next
- * event detected is not of the required type, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if ENDELEMENT is not the next
- * event detected. The erroneous event is pushed back.
- */
- public XmlEvent expectEndElement(boolean discardWhiteSpace)
- throws FOPException
- {
- return expectSaxEvent(XmlEvent.ENDELEMENT, discardWhiteSpace);
- }
-
- /**
- * Get the next ENDELEMENT event with the given <tt>QName</tt>
- * from the buffer. Discard any other events preceding the
- * ENDELEMENT event.
- * @param qName a <tt>String</tt> with the <tt>QName</tt> of the
- * required STARTELEMENT
- * @return an ENDELEMENT event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getEndElement(String qName) throws FOPException
- {
- return getSaxQNameEvent(XmlEvent.ENDELEMENT, qName);
- }
-
- /**
- * Get the next ENDELEMENT event with the given URI index and local name
- * from the buffer. Discard any other events preceding the
- * ENDELEMENT event.
- * @param uriIndex an <tt>int</tt> with the index of the URI of the
- * required URI
- * @param localName a <tt>String</tt> with the local name of the
- * required ENDELEMENT
- * @return an ENDELEMENT event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getEndElement(int uriIndex, String localName)
- throws FOPException
- {
- return getSaxUriLocalEvent(XmlEvent.ENDELEMENT, uriIndex, localName);
- }
-
- /**
- * Return the next element if it is an ENDELEMENT with the given
- * URI index and local name. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param uriIndex an <tt>int</tt> with the index of the URI of the
- * required URI
- * @param localName a <tt>String</tt> with the local name of the
- * required ENDELEMENT
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a matching ENDELEMENT event.
- * If the next
- * event detected is not an ENDELEMENT, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectEndElement
- (int uriIndex, String localName, boolean discardWhiteSpace)
- throws FOPException
- {
- return expectSaxUriLocalEvent
- (XmlEvent.ENDELEMENT, uriIndex, localName, discardWhiteSpace);
- }
-
- /**
- * Get the next ENDELEMENT event with the given Fo type
- * from the buffer. Discard any other events preceding the
- * ENDELEMENT event.
- * @param foType - the FO type of the required ENDELEMENT
- * @return a matching ENDELEMENT event.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getEndElement(int foType) throws FOPException
- {
- return getSaxFoEvent(XmlEvent.ENDELEMENT, foType);
- }
-
- /**
- * Return the next element if it is an ENDELEMENT with the given
- * FO type. If the next
- * element is not of the required type, push it back onto the buffer.
- * @param foType - the FO type of the required ENDELEMENT
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a matching ENDELEMENT. If the next
- * event detected is not an ENDELEMENT, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectEndElement(int foType, boolean discardWhiteSpace)
- throws FOPException
- {
- return expectSaxFoEvent
- (XmlEvent.ENDELEMENT, foType, discardWhiteSpace);
- }
-
- /**
- * Get the next ENDELEMENT event, with the same URI index and local name
- * as the <tt>XmlEvent</tt> argument, from the buffer.
- * Discard any other events preceding the ENDELEMENT event.
- * @param event an <tt>XmlEvent</tt>. Only the uriIndex and the
- * localName from the event are used. It is intended that the XmlEvent
- * returned to the corresponding get/expectStartElement() call be used.
- * @return an ENDELEMENT event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getEndElement(XmlEvent event) throws FOPException
- {
- int foType;
- if ((foType = event.getFoType()) != FObjectNames.NO_FO)
- return getSaxFoEvent(XmlEvent.ENDELEMENT, foType);
- return getSaxUriLocalEvent
- (XmlEvent.ENDELEMENT, event.uriIndex, event.localName);
- }
-
- /**
- * Return the next element if it is an ENDELEMENT with the same
- * URI index and local name as the <tt>XmlEvent argument</tt>. If the
- * next element is not of the required type, push it back onto the buffer.
- * @param event an <tt>XmlEvent</tt>. Only the uriIndex and the
- * localName from the event are used. It is intended that the XmlEvent
- * returned to the corresponding get/expectStartElement() call be used.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a matching ENDELEMENT event. If the next
- * event detected is not an ENDELEMENT, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectEndElement
- (XmlEvent event, boolean discardWhiteSpace)
- throws FOPException
- {
- int foType;
- if ((foType = event.getFoType()) != FObjectNames.NO_FO)
- return expectSaxFoEvent
- (XmlEvent.ENDELEMENT, foType, discardWhiteSpace);
- return expectSaxUriLocalEvent
- (XmlEvent.ENDELEMENT, event.uriIndex, event.localName,
- discardWhiteSpace);
- }
-
- /**
- * Get the next ENDELEMENT event, with the same URI index and local name
- * as the <tt>XmlEvent</tt> argument, from the buffer.
- * Discard any other events preceding the ENDELEMENT event.
- * @param discardEvent the argument event may be discarded.
- * @param event an <tt>XmlEvent</tt>. Only the uriIndex and the
- * localName from the event are used. It is intended that the XmlEvent
- * returned to the corresponding get/expectStartElement() call be used.
- * @return an ENDELEMENT event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getEndElement(boolean discardEvent, XmlEvent event)
- throws FOPException
- {
- XmlEvent ev;
- int foType;
- if ((foType = event.getFoType()) != FObjectNames.NO_FO)
- ev = getSaxFoEvent(XmlEvent.ENDELEMENT, foType);
- else
- ev = getSaxUriLocalEvent
- (XmlEvent.ENDELEMENT, event.uriIndex, event.localName);
- if (discardEvent) {
- //System.out.println("discardEvent");
- namespaces.surrenderEvent(event);
- }
- return ev;
- }
-
- /**
- * Return the next element if it is an ENDELEMENT with the same
- * URI index and local name as the <tt>XmlEvent argument</tt>. If the
- * next element is not of the required type, push it back onto the buffer.
- * @param discardEvent the argument event may be discarded.
- * @param event an <tt>XmlEvent</tt>. Only the uriIndex and the
- * localName from the event are used. It is intended that the XmlEvent
- * returned to the corresponding get/expectStartElement() call be used.
- * @param discardWhiteSpace - if true, discard any <tt>characters</tt>
- * events which contain only whitespace.
- * @return a matching ENDELEMENT event. If the next
- * event detected is not an ENDELEMENT, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectEndElement
- (boolean discardEvent, XmlEvent event, boolean discardWhiteSpace)
- throws FOPException
- {
- XmlEvent ev;
- int foType;
- if ((foType = event.getFoType()) != FObjectNames.NO_FO)
- ev = expectSaxFoEvent
- (XmlEvent.ENDELEMENT, foType, discardWhiteSpace);
- else
- ev = expectSaxUriLocalEvent
- (XmlEvent.ENDELEMENT, event.uriIndex, event.localName,
- discardWhiteSpace);
- if (discardEvent)
- namespaces.surrenderEvent(event);
- return ev;
- }
-
- /**
- * @return a CHARACTERS event
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if the event is not found
- */
- public XmlEvent getCharacters() throws FOPException {
- XmlEvent ev = getEvent();
- while (ev != null && ev.type != XmlEvent.CHARACTERS) {
- namespaces.surrenderEvent(ev);
- ev = getEvent();
- }
- if (ev == null) {
- throw new NoSuchElementException("Characters not found.");
- }
- return ev;
- }
-
- /**
- * @return a CHARACTERS event. If the next event detected is not
- * a CHARACTERS event, <tt>null</tt> is returned.
- * The erroneous event is pushed back.
- * @exception FOPException if buffer errors or interrupts occur
- * @exception NoSuchElementException if end of buffer detected.
- */
- public XmlEvent expectCharacters() throws FOPException {
- XmlEvent ev = getEvent();
- if (ev != null && ev.type == XmlEvent.CHARACTERS) {
- return ev;
- }
- pushBack(ev);
- return null;
}
}
1.1.2.5 +11 -11 xml-fop/src/java/org/apache/fop/xml/Attic/Namespaces.java
Index: Namespaces.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/xml/Attic/Namespaces.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- Namespaces.java 15 Jan 2004 03:16:25 -0000 1.1.2.4
+++ Namespaces.java 20 Jan 2004 05:45:54 -0000 1.1.2.5
@@ -341,13 +341,13 @@
}
/**
- * Surrender an event. This method selects the appropriate pool
+ * Relinquish an event. This method selects the appropriate pool
* according to the event namespace index, and passes the request to
* the pool.
- * @param event to surrender
+ * @param event to relinquish
*/
- public void surrenderEvent(XmlEvent event) {
- pools[event.uriIndex].surrenderPoolable(event);
+ public void relinquishEvent(XmlEvent event) {
+ pools[event.uriIndex].relinquishPoolable(event);
}
/**
@@ -361,12 +361,12 @@
}
/**
- * Surrender a <code>UriLocalName</code>.
+ * Relinquish a <code>UriLocalName</code>.
* The name is returned to the pool.
- * @param uriName to surrender
+ * @param uriName to relinquish
*/
- public void surrenderUriLocalName(UriLocalName uriName) {
- uriLocalNamePool.surrenderPoolable(uriName);
+ public void relinquishUriLocalName(UriLocalName uriName) {
+ uriLocalNamePool.relinquishPoolable(uriName);
}
/**
No revision
Index: Namespaces.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/xml/Attic/Namespaces.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- Namespaces.java 15 Jan 2004 03:16:25 -0000 1.1.2.4
+++ Namespaces.java 20 Jan 2004 05:45:54 -0000 1.1.2.5
@@ -341,13 +341,13 @@
}
/**
- * Surrender an event. This method selects the appropriate pool
+ * Relinquish an event. This method selects the appropriate pool
* according to the event namespace index, and passes the request to
* the pool.
- * @param event to surrender
+ * @param event to relinquish
*/
- public void surrenderEvent(XmlEvent event) {
- pools[event.uriIndex].surrenderPoolable(event);
+ public void relinquishEvent(XmlEvent event) {
+ pools[event.uriIndex].relinquishPoolable(event);
}
/**
@@ -361,12 +361,12 @@
}
/**
- * Surrender a <code>UriLocalName</code>.
+ * Relinquish a <code>UriLocalName</code>.
* The name is returned to the pool.
- * @param uriName to surrender
+ * @param uriName to relinquish
*/
- public void surrenderUriLocalName(UriLocalName uriName) {
- uriLocalNamePool.surrenderPoolable(uriName);
+ public void relinquishUriLocalName(UriLocalName uriName) {
+ uriLocalNamePool.relinquishPoolable(uriName);
}
/**
No revision
Index: Namespaces.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/xml/Attic/Namespaces.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- Namespaces.java 15 Jan 2004 03:16:25 -0000 1.1.2.4
+++ Namespaces.java 20 Jan 2004 05:45:54 -0000 1.1.2.5
@@ -341,13 +341,13 @@
}
/**
- * Surrender an event. This method selects the appropriate pool
+ * Relinquish an event. This method selects the appropriate pool
* according to the event namespace index, and passes the request to
* the pool.
- * @param event to surrender
+ * @param event to relinquish
*/
- public void surrenderEvent(XmlEvent event) {
- pools[event.uriIndex].surrenderPoolable(event);
+ public void relinquishEvent(XmlEvent event) {
+ pools[event.uriIndex].relinquishPoolable(event);
}
/**
@@ -361,12 +361,12 @@
}
/**
- * Surrender a <code>UriLocalName</code>.
+ * Relinquish a <code>UriLocalName</code>.
* The name is returned to the pool.
- * @param uriName to surrender
+ * @param uriName to relinquish
*/
- public void surrenderUriLocalName(UriLocalName uriName) {
- uriLocalNamePool.surrenderPoolable(uriName);
+ public void relinquishUriLocalName(UriLocalName uriName) {
+ uriLocalNamePool.relinquishPoolable(uriName);
}
/**
1.1.2.1 +1246 -0 xml-fop/src/java/org/apache/fop/xml/Attic/XmlEventReader.java
No revision
No revision
1.1.2.5 +8 -8 xml-fop/src/java/org/apache/fop/fo/declarations/Attic/FoDeclarations.java
Index: FoDeclarations.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/declarations/Attic/FoDeclarations.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- FoDeclarations.java 15 Jan 2004 03:01:53 -0000 1.1.2.4
+++ FoDeclarations.java 20 Jan 2004 05:45:55 -0000 1.1.2.5
@@ -64,7 +64,7 @@
import org.apache.fop.fo.FObjectNames;
import org.apache.fop.fo.PropNames;
import org.apache.fop.fo.expr.PropertyException;
-import org.apache.fop.xml.SyncedXmlEventsBuffer;
+import org.apache.fop.xml.XmlEventReader;
import org.apache.fop.xml.XmlEvent;
/**
@@ -123,16 +123,16 @@
throw new FOPException
("No fo:color-profile in fo:declarations.");
new FoColorProfile(foTree, this, ev);
- ev = xmlevents.getEndElement(SyncedXmlEventsBuffer.DISCARD_EV, ev);
- namespaces.surrenderEvent(ev);
+ ev = xmlevents.getEndElement(XmlEventReader.DISCARD_EV, ev);
+ namespaces.relinquishEvent(ev);
do {
ev = xmlevents.expectStartElement
(FObjectNames.COLOR_PROFILE, XmlEvent.DISCARD_W_SPACE);
if (ev == null) break; // No instance of these elements found
new FoColorProfile(foTree, this, ev);
// Flush the master event
- ev = xmlevents.getEndElement(SyncedXmlEventsBuffer.DISCARD_EV, ev);
- namespaces.surrenderEvent(ev);
+ ev = xmlevents.getEndElement(XmlEventReader.DISCARD_EV, ev);
+ namespaces.relinquishEvent(ev);
} while (true);
} catch (NoSuchElementException e) {
// Unexpected end of file
No revision
No revision
1.1.2.4 +8 -8 xml-fop/src/java/org/apache/fop/fo/Attic/FOTree.java
Index: FOTree.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Attic/FOTree.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- FOTree.java 15 Jan 2004 03:01:54 -0000 1.1.2.3
+++ FOTree.java 20 Jan 2004 05:45:55 -0000 1.1.2.4
@@ -63,8 +63,8 @@
import org.apache.fop.datatypes.PropertyValue;
import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.expr.PropertyParser;
-import org.apache.fop.xml.SyncedXmlEventsBuffer;
import org.apache.fop.xml.XmlEvent;
+import org.apache.fop.xml.XmlEventReader;
/**
* <tt>FOTree</tt> is the class that generates and maintains the FO Tree.
@@ -80,7 +80,7 @@
* The buffer from which the <tt>XmlEvent</tt>s from the parser will
* be read. <tt>protected</tt> so that FONode can access it.
*/
- protected SyncedXmlEventsBuffer xmlevents;
+ protected XmlEventReader xmlevents;
private Thread parserThread;
private boolean errorDump;
@@ -94,7 +94,7 @@
* @param xmlevents the buffer from which <tt>XmlEvent</tt>s from the
* parser are read.
*/
- public FOTree(SyncedXmlEventsBuffer xmlevents)
+ public FOTree(XmlEventReader xmlevents)
throws PropertyException
{
super();
@@ -139,7 +139,7 @@
* parser events.
* @return <i>xmlevents</i>.
*/
- public SyncedXmlEventsBuffer getXmlevents() {
+ public XmlEventReader getXmlEventReader() {
return xmlevents;
}
@@ -158,7 +158,7 @@
foRoot.buildFoTree();
System.out.println("Back from buildFoTree");
// Clean up the fo:root event
- event = xmlevents.getEndElement(SyncedXmlEventsBuffer.DISCARD_EV, event);
+ event = xmlevents.getEndElement(XmlEventReader.DISCARD_EV, event);
// Get the end of document
xmlevents.getEndDocument();
} catch (Exception e) {
1.1.2.7 +12 -12 xml-fop/src/java/org/apache/fop/fo/Attic/FoRoot.java
Index: FoRoot.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Attic/FoRoot.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- FoRoot.java 15 Jan 2004 03:10:58 -0000 1.1.2.6
+++ FoRoot.java 20 Jan 2004 05:45:55 -0000 1.1.2.7
@@ -66,9 +66,9 @@
import org.apache.fop.fo.flow.FoPageSequence;
import org.apache.fop.fo.pagination.FoLayoutMasterSet;
import org.apache.fop.xml.FoXmlEvent;
-import org.apache.fop.xml.SyncedXmlEventsBuffer;
import org.apache.fop.xml.XmlEvent;
import org.apache.fop.xml.Namespaces;
+import org.apache.fop.xml.XmlEventReader;
/**
* <tt>FoRoot</tt> is the class which processes the fo:root start element
@@ -175,8 +175,8 @@
new FoLayoutMasterSet(getFOTree(), this, ev);
// Clean up the fo:layout-master-set event
pageSequenceMasters = layoutMasters.getPageSequenceMasters();
- ev = xmlevents.getEndElement(SyncedXmlEventsBuffer.DISCARD_EV, ev);
- namespaces.surrenderEvent(ev);
+ ev = xmlevents.getEndElement(XmlEventReader.DISCARD_EV, ev);
+ namespaces.relinquishEvent(ev);
layoutMasters.deleteSubTree();
// Look for optional declarations
@@ -187,8 +187,8 @@
// process the declarations
declarations = numChildren();
new FoDeclarations(getFOTree(), this, ev);
- ev = xmlevents.getEndElement(SyncedXmlEventsBuffer.DISCARD_EV, ev);
- namespaces.surrenderEvent(ev);
+ ev = xmlevents.getEndElement(XmlEventReader.DISCARD_EV, ev);
+ namespaces.relinquishEvent(ev);
}
// Process page-sequences here
@@ -200,15 +200,15 @@
throw new FOPException("No page-sequence found.");
firstPageSeq = numChildren();
new FoPageSequence(getFOTree(), this, (FoXmlEvent)ev);
- ev = xmlevents.getEndElement(SyncedXmlEventsBuffer.DISCARD_EV, ev);
- namespaces.surrenderEvent(ev);
+ ev = xmlevents.getEndElement(XmlEventReader.DISCARD_EV, ev);
+ namespaces.relinquishEvent(ev);
while ((ev = xmlevents.expectStartElement
(FObjectNames.PAGE_SEQUENCE, XmlEvent.DISCARD_W_SPACE))
!= null) {
// Loop over remaining fo:page-sequences
new FoPageSequence(getFOTree(), this, (FoXmlEvent)ev);
- ev = xmlevents.getEndElement(SyncedXmlEventsBuffer.DISCARD_EV, ev);
- namespaces.surrenderEvent(ev);
+ ev = xmlevents.getEndElement(XmlEventReader.DISCARD_EV, ev);
+ namespaces.relinquishEvent(ev);
}
} catch (NoSuchElementException e) {
throw new FOPException
1.2.2.8 +5 -5 xml-fop/src/java/org/apache/fop/fo/FONode.java
Index: FONode.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FONode.java,v
retrieving revision 1.2.2.7
retrieving revision 1.2.2.8
diff -u -r1.2.2.7 -r1.2.2.8
--- FONode.java 17 Jan 2004 06:31:26 -0000 1.2.2.7
+++ FONode.java 20 Jan 2004 05:45:55 -0000 1.2.2.8
@@ -76,8 +76,8 @@
import org.apache.fop.messaging.MessageHandler;
import org.apache.fop.xml.FoXmlEvent;
import org.apache.fop.xml.XmlEvent;
-import org.apache.fop.xml.SyncedXmlEventsBuffer;
import org.apache.fop.xml.Namespaces;
+import org.apache.fop.xml.XmlEventReader;
/**
* Class for nodes in the FO tree.
@@ -142,10 +142,10 @@
PAGESEQ | FLOW | STATIC | TITLE | MC_MARKER;
/** The buffer from which parser events are drawn. */
- protected final SyncedXmlEventsBuffer xmlevents;
+ protected final XmlEventReader xmlevents;
/** The namespaces object associated with <i>xmlevents</i>. */
- protected Namespaces namespaces;
+ protected final Namespaces namespaces;
/** The FO type. */
public final int type;
@@ -616,8 +616,8 @@
new FoMarker(getFOTree(), this, (FoXmlEvent)ev, stateFlags);
numMarkers++;
ev = xmlevents.getEndElement(
- SyncedXmlEventsBuffer.DISCARD_EV, ev);
- namespaces.surrenderEvent(ev);
+ XmlEventReader.DISCARD_EV, ev);
+ namespaces.relinquishEvent(ev);
}
} catch (TreeException e) {
throw new FOPException(e);
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org