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/14 17:22:13 UTC
cvs commit: xml-fop/src/java/org/apache/fop/xml XMLEvent.java
pbwest 2004/01/14 08:22:12
Modified: src/java/org/apache/fop/xml Tag: FOP_0-20-0_Alt-Design
XMLEvent.java
Log:
Extends Poolable
Defaults to XMLNamespaces.DefAttrNSIndex
Constructor requires sequence
clear() return Poolable
Revision Changes Path
No revision
No revision
1.1.2.4 +25 -22 xml-fop/src/java/org/apache/fop/xml/Attic/XMLEvent.java
Index: XMLEvent.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/xml/Attic/XMLEvent.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- XMLEvent.java 10 Jan 2004 06:29:50 -0000 1.1.2.3
+++ XMLEvent.java 14 Jan 2004 16:22:12 -0000 1.1.2.4
@@ -53,7 +53,8 @@
*/
package org.apache.fop.xml;
-import org.apache.fop.apps.FOPException;
+import org.apache.fop.pool.Poolable;
+
import org.xml.sax.helpers.AttributesImpl;
/**
@@ -63,7 +64,7 @@
* <tt>XMLSerialHandler</tt> methods set the values directly.
*/
-public class XMLEvent {
+public class XMLEvent extends Poolable {
private static final String tag = "$Name$";
private static final String revision = "$Revision$";
@@ -105,26 +106,25 @@
// the basic XML events are unlikely to change.
protected int type = NOEVENT;
protected String chars;
- protected int uriIndex;
+ protected int uriIndex = XMLNamespaces.DefAttrNSIndex;
protected String localName;
protected String qName;
protected AttributesImpl attributes;
protected XMLNamespaces namespaces;
-
- /** Sequence id for this event */
- public final int id;
/**
* The one-argument constructor uses the default initialization values:
- * NOEVENT for the event <i>type</i>, and null references for all others
- * except <i>namespaces</i>.
+ * NOEVENT for the event <i>type</i>, the default attribute namespace,
+ * and null references for all others except <i>namespaces</i>.
* @param namespaces the object maintaing the URIs and their indices
* @param sequence the sequence number of this event within its
* namespace
+ * @param uriIndex the namespace index
*/
- public XMLEvent (XMLNamespaces namespaces, int sequence) {
+ public XMLEvent (XMLNamespaces namespaces, int sequence, int uriIndex ) {
+ super(sequence);
this.namespaces = namespaces;
- id = sequence;
+ this.uriIndex = uriIndex;
}
/**
@@ -145,8 +145,8 @@
String localName, String qName,
AttributesImpl attributes)
{
+ super(sequence);
this.namespaces = namespaces;
- id = sequence;
this.type = type;
this.chars = chars;
this.uriIndex = uriIndex;
@@ -158,13 +158,13 @@
/**
* The cloning constructor takes a reference to an existing
* <tt>XMLEvent</tt> object. Only the <code>id</code> field is not
- * cloned, but generated by a call on the <code>namespaces</code>
- * object.
- * @param ev the event
+ * cloned, but set from the <code>sequence</code> parameter.
+ * @param ev the event to clone
+ * @param sequence the sequence number of the clone
*/
- public XMLEvent(XMLEvent ev) throws FOPException {
+ public XMLEvent(XMLEvent ev, int sequence) {
+ super(sequence);
namespaces = ev.namespaces;
- id = namespaces.getNextSequence(ev.uriIndex);
type = ev.type;
chars = ev.chars;
uriIndex = ev.uriIndex;
@@ -180,11 +180,14 @@
* @param namespaces the object maintaing URIs and their indices
*/
public XMLEvent(XMLNamespaces namespaces, int sequence,
- int type, String chars) {
+ int uriIndex, int type, String chars) {
+ super(sequence);
this.namespaces = namespaces;
- id = sequence;
this.type = type;
this.chars = chars;
+ // N.B. CHARACTERS events have no namespace - they should always
+ // belong to the DefAttrNSpace
+ this.uriIndex = uriIndex;
}
/**
@@ -192,7 +195,7 @@
* Neither the <i>namespaces</i> nor the <i>id</i> field is cleared.
* @return the cleared event.
*/
- public XMLEvent clear() {
+ public Poolable clear() {
type = NOEVENT;
chars = null;
uriIndex = 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org