You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2002/05/07 21:29:05 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/xni XMLDTDHandler.java
elena 02/05/07 12:29:04
Modified: java/src/org/apache/xerces/dom CoreDocumentImpl.java
DeferredDocumentImpl.java DeferredEntityImpl.java
DeferredEntityReferenceImpl.java
DeferredNotationImpl.java
DeferredProcessingInstructionImpl.java
ElementImpl.java ElementNSImpl.java EntityImpl.java
EntityReferenceImpl.java NotationImpl.java
ProcessingInstructionImpl.java
java/src/org/apache/xerces/impl XMLDTDScannerImpl.java
java/src/org/apache/xerces/impl/dtd DTDGrammar.java
XMLDTDValidator.java
java/src/org/apache/xerces/parsers AbstractDOMParser.java
AbstractSAXParser.java
AbstractXMLDocumentParser.java DTDParser.java
java/src/org/apache/xerces/xni XMLDTDHandler.java
Log:
Add implementation for baseURI and documentURI (DOM Level 3).
Add XMLResourceIdentifier to startExternalSubset() method defined in XNI XMLDTDHandler to
allow supporting baseURI for an external subset.
Revision Changes Path
1.16 +9 -2 xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java
Index: CoreDocumentImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- CoreDocumentImpl.java 3 May 2002 17:06:20 -0000 1.15
+++ CoreDocumentImpl.java 7 May 2002 19:29:03 -0000 1.16
@@ -109,7 +109,7 @@
* @author Joe Kesselman, IBM
* @author Andy Clark, IBM
* @author Ralf Pfeiffer, IBM
- * @version $Id: CoreDocumentImpl.java,v 1.15 2002/05/03 17:06:20 lehors Exp $
+ * @version $Id: CoreDocumentImpl.java,v 1.16 2002/05/07 19:29:03 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class CoreDocumentImpl
@@ -806,8 +806,15 @@
public String getDocumentURI(){
return fDocumentURI;
}
-
+ /**
+ * DOM Level 3 WD - Experimental.
+ * Retrieve baseURI
+ */
+ public String getBaseURI() {
+ return fDocumentURI;
+ }
+
/**
* DOM Level 3 WD - Experimental.
*/
1.45 +70 -9 xml-xerces/java/src/org/apache/xerces/dom/DeferredDocumentImpl.java
Index: DeferredDocumentImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DeferredDocumentImpl.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- DeferredDocumentImpl.java 26 Apr 2002 18:32:57 -0000 1.44
+++ DeferredDocumentImpl.java 7 May 2002 19:29:03 -0000 1.45
@@ -74,7 +74,7 @@
* which associates them with the Document within whose context they
* were created.
*
- * @version $Id: DeferredDocumentImpl.java,v 1.44 2002/04/26 18:32:57 elena Exp $
+ * @version $Id: DeferredDocumentImpl.java,v 1.45 2002/05/07 19:29:03 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class DeferredDocumentImpl
@@ -260,18 +260,28 @@
/** Creates a notation in the table. */
public int createDeferredNotation(String notationName,
- String publicId, String systemId) {
+ String publicId, String systemId, String baseURI) {
// create node
int nodeIndex = createNode(Node.NOTATION_NODE);
int chunk = nodeIndex >> CHUNK_SHIFT;
int index = nodeIndex & CHUNK_MASK;
+
+ // create extra data node
+ int extraDataIndex = createNode(Node.NOTATION_NODE);
+ int echunk = extraDataIndex >> CHUNK_SHIFT;
+ int eindex = extraDataIndex & CHUNK_MASK;
+
// save name, public id, system id, and notation name
setChunkValue(fNodeName, notationName, chunk, index);
setChunkValue(fNodeValue, publicId, chunk, index);
setChunkValue(fNodeURI, systemId, chunk, index);
+ // in extra data node set baseURI value
+ setChunkIndex(fNodeExtra, extraDataIndex, chunk, index);
+ setChunkValue(fNodeName, baseURI, echunk, eindex);
+
// return node index
return nodeIndex;
@@ -279,14 +289,15 @@
/** Creates an entity in the table. */
public int createDeferredEntity(String entityName, String publicId,
- String systemId, String notationName) {
+ String systemId, String notationName,
+ String baseURI) {
// create node
int nodeIndex = createNode(Node.ENTITY_NODE);
int chunk = nodeIndex >> CHUNK_SHIFT;
int index = nodeIndex & CHUNK_MASK;
// create extra data node
- int extraDataIndex = createNode((short)0); // node type unimportant
+ int extraDataIndex = createNode(Node.ENTITY_NODE);
int echunk = extraDataIndex >> CHUNK_SHIFT;
int eindex = extraDataIndex & CHUNK_MASK;
@@ -295,18 +306,39 @@
setChunkValue(fNodeValue, publicId, chunk, index);
setChunkValue(fNodeURI, systemId, chunk, index);
setChunkIndex(fNodeExtra, extraDataIndex, chunk, index);
-
+ // set other values in the extra chunk
+ // notation
setChunkValue(fNodeName, notationName, echunk, eindex);
-
- // initialize encoding and version for DOM Level 3 - el
+ // version L3
setChunkValue(fNodeValue, null, echunk, eindex);
+ // encoding L3
setChunkValue(fNodeURI, null, echunk, eindex);
+
+
+ int extraDataIndex2 = createNode(Node.ENTITY_NODE);
+ int echunk2 = extraDataIndex2 >> CHUNK_SHIFT;
+ int eindex2 = extraDataIndex2 & CHUNK_MASK;
+
+ setChunkIndex(fNodeExtra, extraDataIndex2, echunk, eindex);
+
+ // baseURI
+ setChunkValue(fNodeName, baseURI, echunk2, eindex2);
+
// return node index
return nodeIndex;
} // createDeferredEntity(String,String,String,String):int
- // DOM Level 3 - el
+ public String getDeferredEntityBaseURI (int entityIndex){
+ if (entityIndex != -1) {
+ int extraDataIndex = getNodeExtra(entityIndex, false);
+ extraDataIndex = getNodeExtra(extraDataIndex, false);
+ return getNodeName (extraDataIndex, false);
+ }
+ return null;
+ }
+
+ // DOM Level 3
// setting encoding and version
public void setEntityInfo(int currentEntityDecl,
String version, String encoding){
@@ -319,14 +351,31 @@
}
}
+
+ // DOM Level 3
+ // setting actual encoding
+ public void setActualEncoding(int currentEntityDecl, String value){
+ // get first extra data chunk
+ int nodeIndex = getNodeExtra(currentEntityDecl, false);
+ // get second extra data chunk
+ int extraDataIndex = getNodeExtra(nodeIndex, false);
+
+ int echunk = extraDataIndex >> CHUNK_SHIFT;
+ int eindex = extraDataIndex & CHUNK_MASK;
+
+ setChunkValue(fNodeValue, value, echunk, eindex);
+
+ }
+
/** Creates an entity reference node in the table. */
- public int createDeferredEntityReference(String name) {
+ public int createDeferredEntityReference(String name, String baseURI) {
// create node
int nodeIndex = createNode(Node.ENTITY_REFERENCE_NODE);
int chunk = nodeIndex >> CHUNK_SHIFT;
int index = nodeIndex & CHUNK_MASK;
setChunkValue(fNodeName, name, chunk, index);
+ setChunkValue(fNodeValue, baseURI, chunk, index);
// return node index
return nodeIndex;
@@ -467,7 +516,19 @@
int index = nodeIndex & CHUNK_MASK;
setChunkValue(fNodeName, target, chunk, index);
setChunkValue(fNodeValue, data, chunk, index);
+ // return node index
+ return nodeIndex;
+
+ } // createDeferredProcessingInstruction(String,String):int
+
+ /** Set a baseURI for a processing instruction node in the table. */
+ public int setDeferredPIBaseURI(int nodeIndex, String baseURI) {
+
+ // create node
+ int chunk = nodeIndex >> CHUNK_SHIFT;
+ int index = nodeIndex & CHUNK_MASK;
+ setChunkValue(fNodeURI, baseURI, chunk, index);
// return node index
return nodeIndex;
1.16 +9 -3 xml-xerces/java/src/org/apache/xerces/dom/DeferredEntityImpl.java
Index: DeferredEntityImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DeferredEntityImpl.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DeferredEntityImpl.java 29 Jan 2002 01:15:07 -0000 1.15
+++ DeferredEntityImpl.java 7 May 2002 19:29:03 -0000 1.16
@@ -89,7 +89,7 @@
* simplest solution.
*
*
- * @version $Id: DeferredEntityImpl.java,v 1.15 2002/01/29 01:15:07 lehors Exp $
+ * @version $Id: DeferredEntityImpl.java,v 1.16 2002/05/07 19:29:03 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class DeferredEntityImpl
@@ -159,12 +159,18 @@
systemId = ownerDocument.getNodeURI(fNodeIndex);
int extraDataIndex = ownerDocument.getNodeExtra(fNodeIndex);
ownerDocument.getNodeType(extraDataIndex);
+
notationName = ownerDocument.getNodeName(extraDataIndex);
- // DOM Level 3 adding experimental features -el
+ // encoding and version DOM L3
version = ownerDocument.getNodeValue(extraDataIndex);
encoding = ownerDocument.getNodeURI(extraDataIndex);
-
+
+ // baseURI, actualEncoding DOM L3
+ int extraIndex2 = ownerDocument.getNodeExtra(extraDataIndex);
+ baseURI = ownerDocument.getNodeName(extraIndex2);
+ actualEncoding = ownerDocument.getNodeValue(extraIndex2);
+
} // synchronizeData()
/** Synchronize the children. */
1.18 +2 -1 xml-xerces/java/src/org/apache/xerces/dom/DeferredEntityReferenceImpl.java
Index: DeferredEntityReferenceImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DeferredEntityReferenceImpl.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- DeferredEntityReferenceImpl.java 29 Jan 2002 01:15:07 -0000 1.17
+++ DeferredEntityReferenceImpl.java 7 May 2002 19:29:03 -0000 1.18
@@ -110,7 +110,7 @@
* structure-change-monitoring code I implemented to support
* DeepNodeList.
*
- * @version $Id: DeferredEntityReferenceImpl.java,v 1.17 2002/01/29 01:15:07 lehors Exp $
+ * @version $Id: DeferredEntityReferenceImpl.java,v 1.18 2002/05/07 19:29:03 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class DeferredEntityReferenceImpl
@@ -174,6 +174,7 @@
DeferredDocumentImpl ownerDocument =
(DeferredDocumentImpl)this.ownerDocument;
name = ownerDocument.getNodeName(fNodeIndex);
+ baseURI = ownerDocument.getNodeValue(fNodeIndex);
} // synchronizeData()
1.10 +5 -1 xml-xerces/java/src/org/apache/xerces/dom/DeferredNotationImpl.java
Index: DeferredNotationImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DeferredNotationImpl.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DeferredNotationImpl.java 29 Jan 2002 01:15:07 -0000 1.9
+++ DeferredNotationImpl.java 7 May 2002 19:29:03 -0000 1.10
@@ -75,7 +75,7 @@
* <P>
* Level 1 of the DOM does not support editing Notation contents.
*
- * @version $Id: DeferredNotationImpl.java,v 1.9 2002/01/29 01:15:07 lehors Exp $
+ * @version $Id: DeferredNotationImpl.java,v 1.10 2002/05/07 19:29:03 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class DeferredNotationImpl
@@ -143,6 +143,10 @@
// public and system ids
publicId = ownerDocument.getNodeValue(fNodeIndex);
systemId = ownerDocument.getNodeURI(fNodeIndex);
+ int extraDataIndex = ownerDocument.getNodeExtra(fNodeIndex);
+ ownerDocument.getNodeType(extraDataIndex);
+ baseURI = ownerDocument.getNodeName(extraDataIndex);
+
} // synchronizeData()
1.11 +2 -1 xml-xerces/java/src/org/apache/xerces/dom/DeferredProcessingInstructionImpl.java
Index: DeferredProcessingInstructionImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DeferredProcessingInstructionImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DeferredProcessingInstructionImpl.java 29 Jan 2002 01:15:07 -0000 1.10
+++ DeferredProcessingInstructionImpl.java 7 May 2002 19:29:03 -0000 1.11
@@ -62,7 +62,7 @@
* processor-specific information alongside their actual content. PIs
* are most common in XML, but they are supported in HTML as well.
*
- * @version $Id: DeferredProcessingInstructionImpl.java,v 1.10 2002/01/29 01:15:07 lehors Exp $
+ * @version $Id: DeferredProcessingInstructionImpl.java,v 1.11 2002/05/07 19:29:03 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class DeferredProcessingInstructionImpl
@@ -124,6 +124,7 @@
(DeferredDocumentImpl) this.ownerDocument();
target = ownerDocument.getNodeName(fNodeIndex);
data = ownerDocument.getNodeValueString(fNodeIndex);
+ baseURI = ownerDocument.getNodeURI(fNodeIndex);
} // synchronizeData()
1.44 +21 -1 xml-xerces/java/src/org/apache/xerces/dom/ElementImpl.java
Index: ElementImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ElementImpl.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- ElementImpl.java 12 Apr 2002 01:13:52 -0000 1.43
+++ ElementImpl.java 7 May 2002 19:29:03 -0000 1.44
@@ -88,7 +88,7 @@
* @author Joe Kesselman, IBM
* @author Andy Clark, IBM
* @author Ralf Pfeiffer, IBM
- * @version $Id: ElementImpl.java,v 1.43 2002/04/12 01:13:52 lehors Exp $
+ * @version $Id: ElementImpl.java,v 1.44 2002/05/07 19:29:03 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class ElementImpl
@@ -183,6 +183,26 @@
return newnode;
} // cloneNode(boolean):Node
+
+ /**
+ * DOM Level 3 WD - Experimental.
+ * Retrieve baseURI
+ */
+ public String getBaseURI() {
+
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ if (attributes != null) {
+ Attr attrNode = (Attr)attributes.getNamedItem("xml:base");
+ if (attrNode != null) {
+ return attrNode.getNodeValue();
+ }
+ }
+ return this.ownerNode.getBaseURI();
+ }
+
+
/**
* NON-DOM
1.21 +21 -1 xml-xerces/java/src/org/apache/xerces/dom/ElementNSImpl.java
Index: ElementNSImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ElementNSImpl.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ElementNSImpl.java 3 Apr 2002 23:48:26 -0000 1.20
+++ ElementNSImpl.java 7 May 2002 19:29:03 -0000 1.21
@@ -1,4 +1,4 @@
-/* $Id: ElementNSImpl.java,v 1.20 2002/04/03 23:48:26 elena Exp $ */
+/* $Id: ElementNSImpl.java,v 1.21 2002/05/07 19:29:03 elena Exp $ */
/*
* The Apache Software License, Version 1.1
*
@@ -59,6 +59,7 @@
package org.apache.xerces.dom;
import org.w3c.dom.DOMException;
+import org.w3c.dom.Attr;
/**
@@ -289,5 +290,24 @@
synchronizeData();
}
return localName;
+ }
+
+
+ /**
+ * DOM Level 3 WD - Experimental.
+ * Retrieve baseURI
+ */
+ public String getBaseURI() {
+
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ if (attributes != null) {
+ Attr attrNode = (Attr)attributes.getNamedItemNS("http://www.w3.org/XML/1998/namespace", "base");
+ if (attrNode != null) {
+ return attrNode.getNodeValue();
+ }
+ }
+ return this.ownerNode.getBaseURI();
}
}
1.19 +61 -12 xml-xerces/java/src/org/apache/xerces/dom/EntityImpl.java
Index: EntityImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/EntityImpl.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- EntityImpl.java 22 Feb 2002 15:12:12 -0000 1.18
+++ EntityImpl.java 7 May 2002 19:29:03 -0000 1.19
@@ -57,9 +57,10 @@
package org.apache.xerces.dom;
-import org.w3c.dom.Entity;
+import org.apache.xerces.dom3.Entity3;
import org.w3c.dom.Node;
+
import org.w3c.dom.DOMException;
/**
@@ -82,7 +83,7 @@
* "The DOM Level 1 does not support editing Entity nodes; if a user
* wants to make changes to the contents of an Entity, every related
* EntityReference node has to be replaced in the structure model by
- * a clone of the Entity's contents, and then the desired changes
+ * a clone of the Entity's contents, and then the desired changes
* must be made to each of those clones instead. All the
* descendants of an Entity node are readonly."
* </BLOCKQUOTE>
@@ -91,14 +92,14 @@
* the Entity. Since the DOM explicitly decided not to deal with this,
* _any_ answer will involve a non-DOM operation, and this is the
* simplest solution.
- *
- *
- * @version $Id: EntityImpl.java,v 1.18 2002/02/22 15:12:12 elena Exp $
- * @since PR-DOM-Level-1-19980818.
+ *
+ * @author Elena Litani, IBM
+ * @version $Id: EntityImpl.java,v 1.19 2002/05/07 19:29:03 elena Exp $
+ * @since PR-DOM-Level-1-19980818.
*/
public class EntityImpl
extends ParentNode
- implements Entity {
+ implements Entity3 {
//
// Constants
@@ -123,6 +124,10 @@
/** Encoding */
protected String encoding;
+
+ /** Actual Encoding */
+ protected String actualEncoding;
+
/** Version */
protected String version;
@@ -130,6 +135,9 @@
/** Notation name. */
protected String notationName;
+ /** base uri*/
+ protected String baseURI;
+
//
// Constructors
//
@@ -278,14 +286,36 @@
} // setEncoding (String)
+ /**
+ * An attribute specifying the actual encoding of this entity, when it is
+ * an external parsed entity. This is <code>null</code> otherwise.
+ * @since DOM Level 3
+ */
+ public String getActualEncoding(){
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ return actualEncoding;
+ }
+ /**
+ * An attribute specifying the actual encoding of this entity, when it is
+ * an external parsed entity. This is <code>null</code> otherwise.
+ * @since DOM Level 3
+ */
+ public void setActualEncoding(String actualEncoding){
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ this.actualEncoding = actualEncoding;
+ }
+
/**
* DOM Level 3 WD - experimental
* version - An attribute specifying, as part of the text declaration,
* the version number of this entity, when it is an external parsed entity.
* This is null otherwise
*/
- public void setVersion(String value) {
-
+ public void setVersion(String value) {
if (needsSyncData()) {
synchronizeData();
}
@@ -299,7 +329,6 @@
* specified, this will be null.
*/
public void setSystemId(String id) {
-
if (needsSyncData()) {
synchronizeData();
}
@@ -313,8 +342,7 @@
* Parsed entities, which <em>are</em> in XML format, don't need this and
* set it to null.
*/
- public void setNotationName(String name) {
-
+ public void setNotationName(String name) {
if (needsSyncData()) {
synchronizeData();
}
@@ -322,5 +350,26 @@
} // setNotationName(String)
+
+
+ /**
+ * DOM Level 3 WD - Experimental.
+ * Retrieve baseURI
+ */
+ public String getBaseURI() {
+
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ return (baseURI!=null)?baseURI:((CoreDocumentImpl)getOwnerDocument()).getBaseURI();
+ }
+
+ /** NON-DOM: set base uri*/
+ public void setBaseURI(String uri){
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ baseURI = uri;
+ }
} // class EntityImpl
1.20 +91 -56 xml-xerces/java/src/org/apache/xerces/dom/EntityReferenceImpl.java
Index: EntityReferenceImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/EntityReferenceImpl.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- EntityReferenceImpl.java 22 Feb 2002 15:12:12 -0000 1.19
+++ EntityReferenceImpl.java 7 May 2002 19:29:03 -0000 1.20
@@ -117,12 +117,12 @@
* @author Joe Kesselman, IBM
* @author Andy Clark, IBM
* @author Ralf Pfeiffer, IBM
- * @version $Id: EntityReferenceImpl.java,v 1.19 2002/02/22 15:12:12 elena Exp $
+ * @version $Id: EntityReferenceImpl.java,v 1.20 2002/05/07 19:29:03 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class EntityReferenceImpl
- extends ParentNode
- implements EntityReference {
+extends ParentNode
+implements EntityReference {
//
// Constants
@@ -130,16 +130,18 @@
/** Serialization version. */
static final long serialVersionUID = -7381452955687102062L;
-
+
//
// Data
//
/** Name of Entity referenced */
protected String name;
+ /** Base URI*/
+ protected String baseURI;
/** Entity changes. */
- //protected int entityChanges = -1;
+ //protected int entityChanges = -1;
/** Enable synchronize. */
//protected boolean fEnableSynchronize = false;
@@ -150,12 +152,12 @@
/** Factory constructor. */
public EntityReferenceImpl(CoreDocumentImpl ownerDoc, String name) {
- super(ownerDoc);
+ super(ownerDoc);
this.name = name;
isReadOnly(true);
needsSyncChildren(true);
}
-
+
//
// Node methods
//
@@ -186,6 +188,39 @@
}
/**
+ * DOM Level 3 WD - Experimental.
+ * Retrieve baseURI
+ */
+ public String getBaseURI() {
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ if (baseURI == null) {
+ DocumentType doctype;
+ NamedNodeMap entities;
+ EntityImpl entDef;
+ if (null != (doctype = getOwnerDocument().getDoctype()) &&
+ null != (entities = doctype.getEntities())) {
+
+ entDef = (EntityImpl)entities.getNamedItem(getNodeName());
+ if (entDef !=null) {
+ return entDef.getBaseURI();
+ }
+ }
+ }
+ return baseURI;
+ }
+
+
+ /** NON-DOM: set base uri*/
+ public void setBaseURI(String uri){
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ baseURI = uri;
+ }
+
+ /**
* EntityReference's children are a reflection of those defined in the
* named Entity. This method creates them if they haven't been created yet.
* This doesn't support editing the Entity though, since this only called
@@ -195,12 +230,12 @@
// no need to synchronize again
needsSyncChildren(false);
- DocumentType doctype;
- NamedNodeMap entities;
- EntityImpl entDef;
- if (null != (doctype = getOwnerDocument().getDoctype()) &&
+ DocumentType doctype;
+ NamedNodeMap entities;
+ EntityImpl entDef;
+ if (null != (doctype = getOwnerDocument().getDoctype()) &&
null != (entities = doctype.getEntities())) {
-
+
entDef = (EntityImpl)entities.getNamedItem(getNodeName());
// No Entity by this name, stop here.
@@ -210,13 +245,13 @@
// If entity's definition exists, clone its kids
isReadOnly(false);
for (Node defkid = entDef.getFirstChild();
- defkid != null;
- defkid = defkid.getNextSibling()) {
+ defkid != null;
+ defkid = defkid.getNextSibling()) {
Node newkid = defkid.cloneNode(true);
insertBefore(newkid, null);
}
setReadOnly(true, true);
- }
+ }
}
@@ -256,56 +291,56 @@
* @see DocumentTypeImpl
* @see EntityImpl
*/
- // The Xerces parser invokes callbacks for startEnityReference
- // the parsed value of the entity EACH TIME, so it is actually
- // easier to create the nodes through the callbacks rather than
- // clone the Entity.
+ // The Xerces parser invokes callbacks for startEnityReference
+ // the parsed value of the entity EACH TIME, so it is actually
+ // easier to create the nodes through the callbacks rather than
+ // clone the Entity.
/***
// revisit: enable editing of Entity
private void synchronize() {
if (!fEnableSynchronize) {
return;
}
- DocumentType doctype;
- NamedNodeMap entities;
- EntityImpl entDef;
- if (null != (doctype = getOwnerDocument().getDoctype()) &&
- null != (entities = doctype.getEntities())) {
+ DocumentType doctype;
+ NamedNodeMap entities;
+ EntityImpl entDef;
+ if (null != (doctype = getOwnerDocument().getDoctype()) &&
+ null != (entities = doctype.getEntities())) {
- entDef = (EntityImpl)entities.getNamedItem(getNodeName());
+ entDef = (EntityImpl)entities.getNamedItem(getNodeName());
- // No Entity by this name. If we had a change count, reset it.
- if(null==entDef)
- entityChanges=-1;
-
- // If no kids availalble, wipe any pre-existing children.
- // (See discussion above.)
- // Note that we have to use the superclass to avoid recursion
- // through Synchronize.
- readOnly=false;
- if(null==entDef || !entDef.hasChildNodes())
- for(Node kid=super.getFirstChild();
- kid!=null;
- kid=super.getFirstChild())
- removeChild(kid);
-
- // If entity's definition changed, clone its kids
- // (See discussion above.)
- if(null!=entDef && entDef.changes!=entityChanges) {
- for(Node defkid=entDef.getFirstChild();
- defkid!=null;
- defkid=defkid.getNextSibling()) {
+ // No Entity by this name. If we had a change count, reset it.
+ if(null==entDef)
+ entityChanges=-1;
+
+ // If no kids availalble, wipe any pre-existing children.
+ // (See discussion above.)
+ // Note that we have to use the superclass to avoid recursion
+ // through Synchronize.
+ readOnly=false;
+ if(null==entDef || !entDef.hasChildNodes())
+ for(Node kid=super.getFirstChild();
+ kid!=null;
+ kid=super.getFirstChild())
+ removeChild(kid);
+
+ // If entity's definition changed, clone its kids
+ // (See discussion above.)
+ if(null!=entDef && entDef.changes!=entityChanges) {
+ for(Node defkid=entDef.getFirstChild();
+ defkid!=null;
+ defkid=defkid.getNextSibling()) {
- NodeImpl newkid=(NodeImpl) defkid.cloneNode(true);
- newkid.setReadOnly(true,true);
- insertBefore(newkid,null);
- }
- entityChanges=entDef.changes;
- }
- readOnly=true;
- }
+ NodeImpl newkid=(NodeImpl) defkid.cloneNode(true);
+ newkid.setReadOnly(true,true);
+ insertBefore(newkid,null);
+ }
+ entityChanges=entDef.changes;
+ }
+ readOnly=true;
+ }
}
/***/
-
-
+
+
} // class EntityReferenceImpl
1.15 +23 -1 xml-xerces/java/src/org/apache/xerces/dom/NotationImpl.java
Index: NotationImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/NotationImpl.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- NotationImpl.java 22 Feb 2002 15:12:12 -0000 1.14
+++ NotationImpl.java 7 May 2002 19:29:03 -0000 1.15
@@ -79,7 +79,7 @@
* <P>
* Level 1 of the DOM does not support editing Notation contents.
*
- * @version $Id: NotationImpl.java,v 1.14 2002/02/22 15:12:12 elena Exp $
+ * @version $Id: NotationImpl.java,v 1.15 2002/05/07 19:29:03 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class NotationImpl
@@ -106,6 +106,9 @@
/** System identifier. */
protected String systemId;
+ /** Base URI*/
+ protected String baseURI;
+
//
// Constructors
//
@@ -208,5 +211,24 @@
} // setSystemId(String)
+
+ /**
+ * DOM Level 3 WD - Experimental.
+ * Retrieve baseURI
+ */
+ public String getBaseURI() {
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ return baseURI;
+ }
+
+ /** NON-DOM: set base uri*/
+ public void setBaseURI(String uri){
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ baseURI = uri;
+ }
} // class NotationImpl
1.11 +26 -1 xml-xerces/java/src/org/apache/xerces/dom/ProcessingInstructionImpl.java
Index: ProcessingInstructionImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ProcessingInstructionImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ProcessingInstructionImpl.java 29 Jan 2002 01:15:07 -0000 1.10
+++ ProcessingInstructionImpl.java 7 May 2002 19:29:03 -0000 1.11
@@ -67,7 +67,7 @@
*
* This class inherits from CharacterDataImpl to reuse its setNodeValue method.
*
- * @version $Id: ProcessingInstructionImpl.java,v 1.10 2002/01/29 01:15:07 lehors Exp $
+ * @version $Id: ProcessingInstructionImpl.java,v 1.11 2002/05/07 19:29:03 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class ProcessingInstructionImpl
@@ -86,6 +86,7 @@
//
protected String target;
+ protected String baseURI;
//
// Constructors
@@ -174,5 +175,29 @@
// events, readonly protection, synchronizing, etc.)
setNodeValue(data);
} // setData(String)
+
+
+
+ /**
+ * DOM Level 3 WD - Experimental.
+ * Retrieve baseURI
+ */
+ public String getBaseURI() {
+
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ return (baseURI!=null)?baseURI:ownerNode.getBaseURI();
+ }
+
+
+ /** NON-DOM: set base uri*/
+ public void setBaseURI(String uri){
+ if (needsSyncData()) {
+ synchronizeData();
+ }
+ // if was included in the tree using entity reference
+ baseURI = uri;
+ }
} // class ProcessingInstructionImpl
1.21 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/XMLDTDScannerImpl.java
Index: XMLDTDScannerImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDTDScannerImpl.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- XMLDTDScannerImpl.java 2 May 2002 14:33:35 -0000 1.20
+++ XMLDTDScannerImpl.java 7 May 2002 19:29:04 -0000 1.21
@@ -103,7 +103,7 @@
* @author Glenn Marcy, IBM
* @author Eric Ye, IBM
*
- * @version $Id: XMLDTDScannerImpl.java,v 1.20 2002/05/02 14:33:35 neilg Exp $
+ * @version $Id: XMLDTDScannerImpl.java,v 1.21 2002/05/07 19:29:04 elena Exp $
*/
public class XMLDTDScannerImpl
extends XMLScanner
@@ -461,7 +461,7 @@
if (fDTDHandler != null && !fStartDTDCalled ) {
fDTDHandler.startDTD(fEntityScanner, null);
}
- fDTDHandler.startExternalSubset(null);
+ fDTDHandler.startExternalSubset(fEntityScanner,null);
fExtEntityDepth++;
}
else if (name.charAt(0) == '%') {
1.13 +3 -2 xml-xerces/java/src/org/apache/xerces/impl/dtd/DTDGrammar.java
Index: DTDGrammar.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dtd/DTDGrammar.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- DTDGrammar.java 15 Feb 2002 16:00:29 -0000 1.12
+++ DTDGrammar.java 7 May 2002 19:29:04 -0000 1.13
@@ -94,7 +94,7 @@
* @author Jeffrey Rodriguez, IBM
* @author Andy Clark, IBM
*
- * @version $Id: DTDGrammar.java,v 1.12 2002/02/15 16:00:29 sandygao Exp $
+ * @version $Id: DTDGrammar.java,v 1.13 2002/05/07 19:29:04 elena Exp $
*/
public class DTDGrammar
extends AbstractDTDGrammar
@@ -346,7 +346,8 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void startExternalSubset(Augmentations augs) throws XNIException {
+ public void startExternalSubset(XMLResourceIdentifier identifier,
+ Augmentations augs) throws XNIException {
fReadingExternalDTD = true;
} // startExternalSubset(Augmentations)
1.22 +5 -4 xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java
Index: XMLDTDValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XMLDTDValidator.java 1 Apr 2002 21:46:04 -0000 1.21
+++ XMLDTDValidator.java 7 May 2002 19:29:04 -0000 1.22
@@ -117,7 +117,7 @@
* @author Andy Clark, IBM
* @author Jeffrey Rodriguez IBM
*
- * @version $Id: XMLDTDValidator.java,v 1.21 2002/04/01 21:46:04 neilg Exp $
+ * @version $Id: XMLDTDValidator.java,v 1.22 2002/05/07 19:29:04 elena Exp $
*/
public class XMLDTDValidator
implements XMLComponent,
@@ -995,10 +995,11 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void startExternalSubset(Augmentations augs) throws XNIException {
- fDTDGrammar.startExternalSubset(augs);
+ public void startExternalSubset(XMLResourceIdentifier identifier,
+ Augmentations augs) throws XNIException {
+ fDTDGrammar.startExternalSubset(identifier, augs);
if(fDTDHandler != null){
- fDTDHandler.startExternalSubset(augs);
+ fDTDHandler.startExternalSubset(identifier, augs);
}
}
1.54 +419 -101 xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java
Index: AbstractDOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- AbstractDOMParser.java 29 Apr 2002 16:50:54 -0000 1.53
+++ AbstractDOMParser.java 7 May 2002 19:29:04 -0000 1.54
@@ -69,6 +69,7 @@
import org.apache.xerces.dom.NodeImpl;
import org.apache.xerces.dom.NotationImpl;
import org.apache.xerces.dom.TextImpl;
+import org.apache.xerces.dom.ProcessingInstructionImpl;
import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.xs.AttributePSVImpl;
import org.apache.xerces.impl.xs.XSAttributeDecl;
@@ -77,6 +78,8 @@
import org.apache.xerces.xni.NamespaceContext;
import org.apache.xerces.xni.QName;
import org.apache.xerces.xni.XMLAttributes;
+import org.apache.xerces.xni.XMLDocumentHandler;
+import org.apache.xerces.xni.XMLDTDHandler;
import org.apache.xerces.xni.XMLLocator;
import org.apache.xerces.xni.XMLResourceIdentifier;
import org.apache.xerces.xni.XMLString;
@@ -100,6 +103,8 @@
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.Text;
+import java.util.Stack;
+
/**
* This is the base class of all DOM parsers. It implements the XNI
* callback methods to create the DOM tree. After a successful parse of
@@ -111,10 +116,9 @@
* @author Andy Clark, IBM
* @author Elena Litani, IBM
*
- * @version $Id: AbstractDOMParser.java,v 1.53 2002/04/29 16:50:54 elena Exp $
+ * @version $Id: AbstractDOMParser.java,v 1.54 2002/05/07 19:29:04 elena Exp $
*/
-public abstract class AbstractDOMParser
- extends AbstractXMLDocumentParser {
+public class AbstractDOMParser extends AbstractXMLDocumentParser{
//
// Constants
@@ -187,15 +191,17 @@
// debugging
- /** Set to true and recompile to debug entity references. */
- private static final boolean DEBUG_ENTITY_REF = false;
private static final boolean DEBUG_EVENTS = false;
-
+ private static final boolean DEBUG_BASEURI = false;
//
// Data
//
+
+ /** True if inside DTD. */
+ protected boolean fInDTD;
+
// features
/** Create entity reference nodes. */
@@ -206,7 +212,7 @@
/** Include Comments. */
protected boolean fIncludeComments;
-
+
/** Create cdata nodes. */
protected boolean fCreateCDATANodes;
@@ -230,6 +236,8 @@
/** Current node. */
protected Node fCurrentNode;
protected CDATASection fCurrentCDATASection;
+ protected EntityImpl fCurrentEntityDecl;
+ protected int fDeferredEntityDecl;
/** Character buffer */
protected final StringBuffer fStringBuffer = new StringBuffer(50);
@@ -263,6 +271,10 @@
/** True if saw the first chunk of characters*/
protected boolean fFirstChunk = false;
+
+ /** Base uri stack*/
+ protected Stack fBaseURIStack = new Stack();
+
// data
/** Attribute QName. */
@@ -274,8 +286,10 @@
/** Default constructor. */
protected AbstractDOMParser(XMLParserConfiguration config) {
+
super(config);
+
// add recognized features
fConfiguration.addRecognizedFeatures(RECOGNIZED_FEATURES);
@@ -447,24 +461,67 @@
throws XNIException {
if (DEBUG_EVENTS) {
System.out.println("==>startGeneralEntity ("+name+")");
+ if (DEBUG_BASEURI) {
+ System.out.println(" expandedSystemId( **baseURI): "+identifier.getExpandedSystemId());
+ System.out.println(" baseURI:"+ identifier.getBaseSystemId());
+ }
}
// Always create entity reference nodes to be able to recreate
// entity as a part of doctype
if (!fDeferNodeExpansion) {
setCharacterData(true);
- EntityReference er = fDocument.createEntityReference(name);
- // we don't need synchronization now, because entity ref will be
- // expanded anyway. Synch only needed when user creates entityRef node
- ((EntityReferenceImpl)er).needsSyncChildren(false);
+ EntityReference er = fDocument.createEntityReference(name);
+
+ if (fDocumentImpl != null) {
+ // REVISIT: baseURI/actualEncoding
+ // remove dependency on our implementation when DOM L3 is REC
+ //
+
+ EntityReferenceImpl erImpl =(EntityReferenceImpl)er;
+ // set base uri
+ erImpl.setBaseURI(identifier.getExpandedSystemId());
+
+ if (fDocumentType != null) {
+ // set actual encoding
+ NamedNodeMap entities = fDocumentType.getEntities();
+ fCurrentEntityDecl = (EntityImpl) entities.getNamedItem(name);
+ if (fCurrentEntityDecl != null) {
+ fCurrentEntityDecl.setActualEncoding(encoding);
+ }
+
+ }
+ // we don't need synchronization now, because entity ref will be
+ // expanded anyway. Synch only needed when user creates entityRef node
+ erImpl.needsSyncChildren(false);
+ }
+
fCurrentNode.appendChild(er);
fCurrentNode = er;
}
else {
+
int er =
- fDeferredDocumentImpl.createDeferredEntityReference(name);
- fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, er);
- fCurrentNodeIndex = er;
+ fDeferredDocumentImpl.createDeferredEntityReference(name, identifier.getExpandedSystemId());
+ if (fDocumentTypeIndex != -1) {
+ // find corresponding Entity decl
+ int node = fDeferredDocumentImpl.getLastChild(fDocumentTypeIndex, false);
+ while (node != -1) {
+ short nodeType = fDeferredDocumentImpl.getNodeType(node, false);
+ if (nodeType == Node.ENTITY_NODE) {
+ String nodeName =
+ fDeferredDocumentImpl.getNodeName(node, false);
+ if (nodeName.equals(name)) {
+ fDeferredEntityDecl = node;
+ fDeferredDocumentImpl.setActualEncoding(node, encoding);
+ break;
+ }
+ }
+ node = fDeferredDocumentImpl.getRealPrevSibling(node, false);
+ }
+ }
+ fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, er);
+ fCurrentNodeIndex = er;
}
} // startGeneralEntity(String,XMLResourceIdentifier, Augmentations)
@@ -488,39 +545,14 @@
*/
public void textDecl(String version, String encoding, Augmentations augs) throws XNIException {
if (!fDeferNodeExpansion) {
- // REVISIT: when DOM Level 3 is REC rely on Document.support
- // instead of specific class
- if (fDocumentType != null) {
- NamedNodeMap entities = fDocumentType.getEntities();
- String name = fCurrentNode.getNodeName();
- EntityImpl entity = (EntityImpl) entities.getNamedItem(name);
- if (entity != null) {
- entity.setVersion(version);
- entity.setEncoding(encoding);
- }
+ if (fCurrentEntityDecl != null) {
+ fCurrentEntityDecl.setEncoding(encoding);
+ fCurrentEntityDecl.setVersion(version);
}
}
else {
- String name = fDeferredDocumentImpl.getNodeName(fCurrentNodeIndex, false);
- if (fDocumentTypeIndex != -1 && name != null) {
- // find corresponding Entity decl
- boolean found = false;
- int node = fDeferredDocumentImpl.getLastChild(fDocumentTypeIndex, false);
- while (node != -1) {
- short nodeType = fDeferredDocumentImpl.getNodeType(node, false);
- if (nodeType == Node.ENTITY_NODE) {
- String nodeName =
- fDeferredDocumentImpl.getNodeName(node, false);
- if (nodeName.equals(name)) {
- found = true;
- break;
- }
- }
- node = fDeferredDocumentImpl.getRealPrevSibling(node, false);
- }
- if (found) {
- fDeferredDocumentImpl.setEntityInfo(node, version, encoding);
- }
+ if (fDeferredEntityDecl !=-1) {
+ fDeferredDocumentImpl.setEntityInfo(fDeferredEntityDecl, version, encoding);
}
}
} // textDecl(String,String)
@@ -587,8 +619,12 @@
fInternalSubset.append("?>");
}
+ return;
}
+ if (DEBUG_EVENTS) {
+ System.out.println("==>processingInstruction ("+target+")");
+ }
if (!fDeferNodeExpansion) {
setCharacterData(false);
ProcessingInstruction pi =
@@ -749,6 +785,33 @@
} // doctypeDecl(String,String,String)
/**
+ * The start of a namespace prefix mapping. This method will only be
+ * called when namespace processing is enabled.
+ *
+ * @param prefix The namespace prefix.
+ * @param uri The URI bound to the prefix.
+ * @param augs Additional information that may include infoset augmentations
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void startPrefixMapping(String prefix, String uri, Augmentations augs)
+ throws XNIException {
+ } // startPrefixMapping(String,String)
+
+
+ /**
+ * The end of a namespace prefix mapping. This method will only be
+ * called when namespace processing is enabled.
+ *
+ * @param prefix The namespace prefix.
+ * @param augs Additional information that may include infoset augmentations
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void endPrefixMapping(String prefix, Augmentations augs) throws XNIException {
+ } // endPrefixMapping(String)
+
+ /**
* The start of an element. If the document specifies the start element
* by using an empty tag, then the startElement method will immediately
* be followed by the endElement method, with no intervening methods.
@@ -857,6 +920,24 @@
}
} // startElement(QName,XMLAttributes)
+
+ /**
+ * An empty element.
+ *
+ * @param element The name of the element.
+ * @param attributes The element attributes.
+ * @param augs Additional information that may include infoset augmentations
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
+ throws XNIException {
+
+ startElement(element, attributes, augs);
+ endElement(element, augs);
+
+ } // emptyElement(QName,XMLAttributes)
+
/**
* Character content.
*
@@ -905,8 +986,13 @@
Node child = fCurrentNode.getLastChild();
if (child != null && child.getNodeType() == Node.TEXT_NODE) {
// collect all the data into the string buffer.
- if (fFirstChunk) {
- fStringBuffer.append(((TextImpl)child).removeData());
+ if (fFirstChunk) {
+ if (fDocumentImpl != null) {
+ fStringBuffer.append(((TextImpl)child).removeData());
+ } else {
+ fStringBuffer.append(((Text)child).getData());
+ ((Text)child).setNodeValue(null);
+ }
fFirstChunk = false;
}
fStringBuffer.append(value);
@@ -1032,17 +1118,6 @@
} // endElement(QName)
- /**
- * The end of a namespace prefix mapping. This method will only be
- * called when namespace processing is enabled.
- *
- * @param prefix The namespace prefix.
- * @param augs Additional information that may include infoset augmentations
- *
- * @throws XNIException Thrown by handler to signal an error.
- */
- public void endPrefixMapping(String prefix, Augmentations augs) throws XNIException {
- } // endPrefixMapping(String)
/**
* The start of a CDATA section.
@@ -1110,7 +1185,7 @@
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.
*
- * @param name The name of the entity.
+ * @param name The name of the entity.
* @param augs Additional information that may include infoset augmentations
*
* @exception XNIException
@@ -1122,70 +1197,62 @@
}
if (!fDeferNodeExpansion) {
setCharacterData(true);
- if (fDocumentType != null) {
- NamedNodeMap entities = fDocumentType.getEntities();
- NodeImpl entity = (NodeImpl)entities.getNamedItem(name);
- if (entity != null && entity.getFirstChild() == null) {
- entity.setReadOnly(false, true);
+ if (fCurrentEntityDecl != null) {
+ if (fCurrentEntityDecl != null && fCurrentEntityDecl.getFirstChild() == null) {
+ fCurrentEntityDecl.setReadOnly(false, true);
Node child = fCurrentNode.getFirstChild();
while (child != null) {
Node copy = child.cloneNode(true);
- entity.appendChild(copy);
+ fCurrentEntityDecl.appendChild(copy);
child = child.getNextSibling();
}
- entity.setReadOnly(true, true);
- entities.setNamedItem(entity);
+ fCurrentEntityDecl.setReadOnly(true, true);
+
+ //entities.setNamedItem(fCurrentEntityDecl);
}
+ fCurrentEntityDecl = null;
}
if (fCreateEntityRefNodes) {
- // Make entity ref node read only
- ((NodeImpl)fCurrentNode).setReadOnly(true, true);
+ if (fDocumentImpl != null) {
+ // Make entity ref node read only
+ ((NodeImpl)fCurrentNode).setReadOnly(true, true);
+ }
fCurrentNode = fCurrentNode.getParentNode();
- } else { //!fCreateEntityRefNodes
+ } else {
// move entity reference children to the list of
// siblings of its parent and remove entity reference
NodeList children = fCurrentNode.getChildNodes();
Node parent = fCurrentNode.getParentNode();
int length = children.getLength();
- Node previous = fCurrentNode.getPreviousSibling();
+ // get previous sibling of the entity reference
+ Node node = fCurrentNode.getPreviousSibling();
// normalize text nodes
- if (previous != null && previous.getNodeType() == Node.TEXT_NODE &&
- children.item(0).getNodeType() == Node.TEXT_NODE) {
- ((Text)previous).appendData(children.item(0).getNodeValue());
+ Node child = children.item(0);
+ if (node != null && node.getNodeType() == Node.TEXT_NODE &&
+ child.getNodeType() == Node.TEXT_NODE) {
+ ((Text)node).appendData(child.getNodeValue());
+ fCurrentNode.removeChild(child);
} else {
- parent.insertBefore(children.item(0), fCurrentNode);
+ node = parent.insertBefore(child, fCurrentNode);
+ handleBaseURI(node);
}
for (int i=1;i <length;i++) {
- parent.insertBefore(children.item(0), fCurrentNode);
+ node = parent.insertBefore(children.item(0), fCurrentNode);
+ handleBaseURI(node);
}
parent.removeChild(fCurrentNode);
fCurrentNode = parent;
}
}
else {
- int entityIndex = -1;
- int dtChildIndex = fDeferredDocumentImpl.getLastChild(fDocumentTypeIndex, false);
- while (dtChildIndex != -1) {
- short nodeType = fDeferredDocumentImpl.getNodeType(dtChildIndex, false);
- if (nodeType == Node.ENTITY_NODE) {
- String nodeName = fDeferredDocumentImpl.getNodeName(dtChildIndex, false);
- if (nodeName.equals(name)) {
- if (fDeferredDocumentImpl.getLastChild(dtChildIndex, false) == -1) {
- entityIndex = dtChildIndex;
- }
- break;
- }
- }
- dtChildIndex = fDeferredDocumentImpl.getRealPrevSibling(dtChildIndex, false);
- }
- if (entityIndex != -1) {
+ if (fDeferredEntityDecl != -1) {
int prevIndex = -1;
int childIndex = fDeferredDocumentImpl.getLastChild(fCurrentNodeIndex, false);
while (childIndex != -1) {
int cloneIndex = fDeferredDocumentImpl.cloneNode(childIndex, true);
- fDeferredDocumentImpl.insertBefore(entityIndex, cloneIndex, prevIndex);
+ fDeferredDocumentImpl.insertBefore(fDeferredEntityDecl, cloneIndex, prevIndex);
prevIndex = cloneIndex;
childIndex = fDeferredDocumentImpl.getRealPrevSibling(childIndex, false);
}
@@ -1208,6 +1275,7 @@
int lastChild = childIndex;
int sibling = -1;
while (childIndex != -1) {
+ handleBaseURI(childIndex);
sibling = fDeferredDocumentImpl.getRealPrevSibling(childIndex, false);
fDeferredDocumentImpl.insertBefore(parentIndex, childIndex, prevIndex);
prevIndex = childIndex;
@@ -1216,11 +1284,90 @@
fDeferredDocumentImpl.setAsLastChild(parentIndex, lastChild);
fCurrentNodeIndex = parentIndex;
}
+ fDeferredEntityDecl = -1;
}
} // endGeneralEntity(String, Augmentations)
+
+ /**
+ * Record baseURI information for the Element (by adding xml:base attribute)
+ * or for the ProcessingInstruction (by setting a baseURI field)
+ * Non deferred DOM.
+ *
+ * @param node
+ */
+ protected void handleBaseURI (Node node){
+ if (fDocumentImpl != null) {
+ // REVISIT: remove dependency on our implementation when
+ // DOM L3 becomes REC
+
+ String baseURI = null;
+ short nodeType = node.getNodeType();
+
+ if (nodeType == Node.ELEMENT_NODE) {
+ // if an element already has xml:base attribute
+ // do nothing
+ if (fNamespaceAware && (((Element)node).getAttributeNodeNS("http://www.w3.org/XML/1998/namespace","base")!=null)) {
+ return;
+ } else if (((Element)node).getAttributeNode("xml:base") != null) {
+ return;
+ }
+ // retrive the baseURI from the entity reference
+ baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI();
+ if (baseURI !=null && !baseURI.equals(fDocumentImpl.getDocumentURI())) {
+ if (fNamespaceAware) {
+ ((Element)node).setAttributeNS("http://www.w3.org/XML/1998/namespace","base", baseURI);
+ } else {
+ ((Element)node).setAttribute("xml:base", baseURI);
+ }
+ }
+ }
+ else if (nodeType == Node.PROCESSING_INSTRUCTION_NODE) {
+ baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI();
+ ((ProcessingInstructionImpl)node).setBaseURI(baseURI);
+ }
+ }
+ }
+
+ /**
+ *
+ * Record baseURI information for the Element (by adding xml:base attribute)
+ * or for the ProcessingInstruction (by setting a baseURI field)
+ * Deferred DOM.
+ *
+ * @param node
+ */
+ protected void handleBaseURI (int node){
+ short nodeType = fDeferredDocumentImpl.getNodeType(node, false);
+ if (nodeType == Node.ELEMENT_NODE) {
+ String baseURI = fDeferredDocumentImpl.getNodeValueString(fCurrentNodeIndex, false);
+ if (baseURI == null) {
+ baseURI = fDeferredDocumentImpl.getDeferredEntityBaseURI(fDeferredEntityDecl);
+ }
+ if (baseURI !=null && !baseURI.equals(fDeferredDocumentImpl.getDocumentURI())) {
+ fDeferredDocumentImpl.setDeferredAttribute(node,
+ "xml:base",
+ "http://www.w3.org/XML/1998/namespace",
+ baseURI,
+ true);
+ }
+ }
+ else if (nodeType == Node.PROCESSING_INSTRUCTION_NODE) {
+
+ // retrieve baseURI from the entity reference
+ String baseURI = fDeferredDocumentImpl.getNodeValueString(fCurrentNodeIndex, false);
+
+ if (baseURI == null) {
+ // try baseURI of the entity declaration
+ baseURI = fDeferredDocumentImpl.getDeferredEntityBaseURI(fDeferredEntityDecl);
+ }
+ fDeferredDocumentImpl.setDeferredPIBaseURI(node, baseURI);
+ }
+ }
+
+
//
// XMLDTDHandler methods
//
@@ -1240,12 +1387,22 @@
* @throws XNIException Thrown by handler to signal an error.
*/
public void startDTD(XMLLocator locator, Augmentations augs) throws XNIException {
- super.startDTD(locator, augs);
+ if (DEBUG_EVENTS) {
+ System.out.println("==>startDTD");
+ if (DEBUG_BASEURI) {
+ System.out.println(" expandedSystemId: "+locator.getExpandedSystemId());
+ System.out.println(" baseURI:"+ locator.getBaseSystemId());
+ }
+ }
+
+ fInDTD = true;
+ fBaseURIStack.push(locator.getBaseSystemId());
if (fDeferNodeExpansion || fDocumentImpl != null) {
fInternalSubset = new StringBuffer(1024);
}
} // startDTD(XMLLocator)
+
/**
* The end of the DTD.
*
@@ -1255,7 +1412,11 @@
* @throws XNIException Thrown by handler to signal an error.
*/
public void endDTD(Augmentations augs) throws XNIException {
- super.endDTD(augs);
+ if (DEBUG_EVENTS) {
+ System.out.println("==>endDTD()");
+ }
+ fInDTD = false;
+ fBaseURIStack.pop();
String internalSubset = fInternalSubset != null && fInternalSubset.length() > 0
? fInternalSubset.toString() : null;
if (fDeferNodeExpansion) {
@@ -1271,6 +1432,34 @@
} // endDTD()
/**
+ * The start of a conditional section.
+ *
+ * @param type The type of the conditional section. This value will
+ * either be CONDITIONAL_INCLUDE or CONDITIONAL_IGNORE.
+ * @param augs Additional information that may include infoset
+ * augmentations.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ *
+ * @see #CONDITIONAL_INCLUDE
+ * @see #CONDITIONAL_IGNORE
+ */
+ public void startConditional(short type, Augmentations augs) throws XNIException {
+ } // startConditional(short)
+
+ /**
+ * The end of a conditional section.
+ *
+ * @param augs Additional information that may include infoset
+ * augmentations.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void endConditional(Augmentations augs) throws XNIException {
+ } // endConditional()
+
+
+ /**
* The start of the DTD external subset.
*
* @param augs Additional information that may include infoset
@@ -1278,7 +1467,16 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void startExternalSubset(Augmentations augs) throws XNIException {
+ public void startExternalSubset(XMLResourceIdentifier identifier,
+ Augmentations augs) throws XNIException {
+ if (DEBUG_EVENTS) {
+ System.out.println("==>startExternalSubset");
+ if (DEBUG_BASEURI) {
+ System.out.println(" expandedSystemId: "+identifier.getExpandedSystemId());
+ System.out.println(" baseURI:"+ identifier.getBaseSystemId());
+ }
+ }
+ fBaseURIStack.push(identifier.getBaseSystemId());
fInDTDExternalSubset = true;
} // startExternalSubset(Augmentations)
@@ -1292,6 +1490,7 @@
*/
public void endExternalSubset(Augmentations augs) throws XNIException {
fInDTDExternalSubset = false;
+ fBaseURIStack.pop();
} // endExternalSubset(Augmentations)
/**
@@ -1314,6 +1513,12 @@
XMLString nonNormalizedText,
Augmentations augs) throws XNIException {
+ if (DEBUG_EVENTS) {
+ System.out.println("==>internalEntityDecl: "+name);
+ if (DEBUG_BASEURI) {
+ System.out.println(" baseURI:"+ (String)fBaseURIStack.peek());
+ }
+ }
// internal subset string
if (fInternalSubset != null && !fInDTDExternalSubset) {
fInternalSubset.append("<!ENTITY ");
@@ -1346,6 +1551,7 @@
EntityImpl entity = (EntityImpl)entities.getNamedItem(name);
if (entity == null) {
entity = (EntityImpl)fDocumentImpl.createEntity(name);
+ entity.setBaseURI((String)fBaseURIStack.peek());
entities.setNamedItem(entity);
}
}
@@ -1367,7 +1573,7 @@
}
if (!found) {
int entityIndex =
- fDeferredDocumentImpl.createDeferredEntity(name, null, null, null);
+ fDeferredDocumentImpl.createDeferredEntity(name, null, null, null, (String)fBaseURIStack.peek());
fDeferredDocumentImpl.appendChild(fDocumentTypeIndex, entityIndex);
}
}
@@ -1390,6 +1596,14 @@
public void externalEntityDecl(String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {
+
+ if (DEBUG_EVENTS) {
+ System.out.println("==>externalEntityDecl: "+name);
+ if (DEBUG_BASEURI) {
+ System.out.println(" expandedSystemId:"+ identifier.getExpandedSystemId());
+ System.out.println(" baseURI:"+ identifier.getBaseSystemId());
+ }
+ }
// internal subset string
String publicId = identifier.getPublicId();
String literalSystemId = identifier.getLiteralSystemId();
@@ -1430,6 +1644,7 @@
entity = (EntityImpl)fDocumentImpl.createEntity(name);
entity.setPublicId(publicId);
entity.setSystemId(literalSystemId);
+ entity.setBaseURI(identifier.getBaseSystemId());
entities.setNamedItem(entity);
}
}
@@ -1451,13 +1666,62 @@
}
if (!found) {
int entityIndex = fDeferredDocumentImpl.createDeferredEntity(
- name, publicId, literalSystemId, null);
+ name, publicId, literalSystemId, null, identifier.getBaseSystemId());
fDeferredDocumentImpl.appendChild(fDocumentTypeIndex, entityIndex);
}
}
} // externalEntityDecl(String,XMLResourceIdentifier, Augmentations)
+
+ /**
+ * This method notifies of the start of a parameter entity. The parameter
+ * entity name start with a '%' character.
+ *
+ * @param name The name of the parameter entity.
+ * @param identifier The resource identifier.
+ * @param encoding The auto-detected IANA encoding name of the entity
+ * stream. This value will be null in those situations
+ * where the entity encoding is not auto-detected (e.g.
+ * internal parameter entities).
+ * @param augs Additional information that may include infoset
+ * augmentations.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void startParameterEntity(String name,
+ XMLResourceIdentifier identifier,
+ String encoding,
+ Augmentations augs) throws XNIException {
+ if (DEBUG_EVENTS) {
+ System.out.println("==>startParameterEntity: "+name);
+ if (DEBUG_BASEURI) {
+ System.out.println(" expandedSystemId: "+identifier.getExpandedSystemId());
+ System.out.println(" baseURI:"+ identifier.getBaseSystemId());
+ }
+ }
+ fBaseURIStack.push(identifier.getExpandedSystemId());
+ }
+
+
+ /**
+ * This method notifies the end of a parameter entity. Parameter entity
+ * names begin with a '%' character.
+ *
+ * @param name The name of the parameter entity.
+ * @param augs Additional information that may include infoset
+ * augmentations.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void endParameterEntity(String name, Augmentations augs) throws XNIException {
+
+ if (DEBUG_EVENTS) {
+ System.out.println("==>endParameterEntity: "+name);
+ }
+ fBaseURIStack.pop();
+ }
+
/**
* An unparsed entity declaration.
*
@@ -1474,6 +1738,13 @@
String notation, Augmentations augs)
throws XNIException {
+ if (DEBUG_EVENTS) {
+ System.out.println("==>unparsedEntityDecl: "+name);
+ if (DEBUG_BASEURI) {
+ System.out.println(" expandedSystemId:"+ identifier.getExpandedSystemId());
+ System.out.println(" baseURI:"+ identifier.getBaseSystemId());
+ }
+ }
// internal subset string
String publicId = identifier.getPublicId();
String literalSystemId = identifier.getLiteralSystemId();
@@ -1511,6 +1782,7 @@
entity.setPublicId(publicId);
entity.setSystemId(literalSystemId);
entity.setNotationName(notation);
+ entity.setBaseURI(identifier.getBaseSystemId());
entities.setNamedItem(entity);
}
}
@@ -1532,7 +1804,7 @@
}
if (!found) {
int entityIndex = fDeferredDocumentImpl.createDeferredEntity(
- name, publicId, literalSystemId, notation);
+ name, publicId, literalSystemId, notation, identifier.getBaseSystemId());
fDeferredDocumentImpl.appendChild(fDocumentTypeIndex, entityIndex);
}
}
@@ -1579,12 +1851,13 @@
// that functionality. -Ac
// create full node
- if (fDocumentType != null) {
+ if (fDocumentImpl !=null && fDocumentType != null) {
NamedNodeMap notations = fDocumentType.getNotations();
if (notations.getNamedItem(name) == null) {
NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation(name);
notation.setPublicId(publicId);
notation.setSystemId(literalSystemId);
+ notation.setBaseURI(identifier.getBaseSystemId());
notations.setNamedItem(notation);
}
}
@@ -1606,7 +1879,7 @@
}
if (!found) {
int notationIndex = fDeferredDocumentImpl.createDeferredNotation(
- name, publicId, literalSystemId);
+ name, publicId, literalSystemId, identifier.getBaseSystemId());
fDeferredDocumentImpl.appendChild(fDocumentTypeIndex, notationIndex);
}
}
@@ -1614,6 +1887,19 @@
} // notationDecl(String,XMLResourceIdentifier, Augmentations)
/**
+ * Characters within an IGNORE conditional section.
+ *
+ * @param text The ignored text.
+ * @param augs Additional information that may include infoset
+ * augmentations.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void ignoredCharacters(XMLString text, Augmentations augs) throws XNIException {
+ } // ignoredCharacters(XMLString, Augmentations)
+
+
+ /**
* An element declaration.
*
* @param name The name of the element.
@@ -1782,6 +2068,33 @@
} // attributeDecl(String,String,String,String[],String,XMLString, XMLString, Augmentations)
+
+ /**
+ * The start of an attribute list.
+ *
+ * @param elementName The name of the element that this attribute
+ * list is associated with.
+ * @param augs Additional information that may include infoset
+ * augmentations.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void startAttlist(String elementName, Augmentations augs) throws XNIException {
+ } // startAttlist(String)
+
+
+ /**
+ * The end of an attribute list.
+ *
+ * @param augs Additional information that may include infoset
+ * augmentations.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void endAttlist(Augmentations augs) throws XNIException {
+ } // endAttlist()
+
+
// method to create an element node.
// subclasses can override this method to create element nodes in other ways.
protected Element createElementNode(QName element) {
@@ -1843,7 +2156,12 @@
Node child = fCurrentNode.getLastChild();
// REVISIT: should this check be performed?
if (child != null && child.getNodeType() == Node.TEXT_NODE) {
- ((TextImpl)child).replaceData(fStringBuffer.toString());
+ if (fDocumentImpl != null) {
+ ((TextImpl)child).replaceData(fStringBuffer.toString());
+ }
+ else {
+ ((Text)child).setData(fStringBuffer.toString());
+ }
}
// reset string buffer
fStringBuffer.setLength(0);
1.27 +3 -2 xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java
Index: AbstractSAXParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- AbstractSAXParser.java 26 Apr 2002 10:33:29 -0000 1.26
+++ AbstractSAXParser.java 7 May 2002 19:29:04 -0000 1.27
@@ -111,7 +111,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: AbstractSAXParser.java,v 1.26 2002/04/26 10:33:29 andyc Exp $
+ * @version $Id: AbstractSAXParser.java,v 1.27 2002/05/07 19:29:04 elena Exp $
*/
public abstract class AbstractSAXParser
extends AbstractXMLDocumentParser
@@ -755,7 +755,8 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void startExternalSubset(Augmentations augs) throws XNIException {
+ public void startExternalSubset(XMLResourceIdentifier identifier,
+ Augmentations augs) throws XNIException {
startParameterEntity("[dtd]", null, null, augs);
}
1.12 +3 -2 xml-xerces/java/src/org/apache/xerces/parsers/AbstractXMLDocumentParser.java
Index: AbstractXMLDocumentParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractXMLDocumentParser.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AbstractXMLDocumentParser.java 29 Jan 2002 20:44:03 -0000 1.11
+++ AbstractXMLDocumentParser.java 7 May 2002 19:29:04 -0000 1.12
@@ -84,7 +84,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: AbstractXMLDocumentParser.java,v 1.11 2002/01/29 20:44:03 neilg Exp $
+ * @version $Id: AbstractXMLDocumentParser.java,v 1.12 2002/05/07 19:29:04 elena Exp $
*/
public abstract class AbstractXMLDocumentParser
extends XMLParser
@@ -135,6 +135,7 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
+
public void startDocument(XMLLocator locator, String encoding, Augmentations augs)
throws XNIException {
} // startDocument(XMLLocator,String)
@@ -421,7 +422,7 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void startExternalSubset(Augmentations augmentations)
+ public void startExternalSubset(XMLResourceIdentifier identifier, Augmentations augmentations)
throws XNIException {
} // startExternalSubset(Augmentations)
1.10 +36 -19 xml-xerces/java/src/org/apache/xerces/parsers/DTDParser.java
Index: DTDParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DTDParser.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DTDParser.java 29 Jan 2002 01:15:17 -0000 1.9
+++ DTDParser.java 7 May 2002 19:29:04 -0000 1.10
@@ -59,15 +59,18 @@
import org.apache.xerces.impl.dtd.DTDGrammar;
import org.apache.xerces.util.SymbolTable;
+
+import org.apache.xerces.xni.Augmentations;
import org.apache.xerces.xni.XMLString;
import org.apache.xerces.xni.XMLDTDContentModelHandler;
import org.apache.xerces.xni.XMLDTDHandler;
import org.apache.xerces.xni.XMLLocator;
import org.apache.xerces.xni.XNIException;
import org.apache.xerces.xni.parser.XMLDTDScanner;
+import org.apache.xerces.xni.XMLResourceIdentifier;
/**
- * @version $Id: DTDParser.java,v 1.9 2002/01/29 01:15:17 lehors Exp $
+ * @version $Id: DTDParser.java,v 1.10 2002/05/07 19:29:04 elena Exp $
*/
public abstract class DTDParser
extends XMLGrammarParser
@@ -155,8 +158,9 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void startDTD(XMLLocator locator) throws XNIException {
- } // startDTD(XMLLocator)
+ public void startDTD(XMLLocator locator, Augmentations augmentations)
+ throws XNIException {
+ }
/**
* A comment.
@@ -165,7 +169,7 @@
*
* @throws XNIException Thrown by application to signal an error.
*/
- public void comment(XMLString text) throws XNIException {
+ public void comment(XMLString text, Augmentations augmentations) throws XNIException {
} // comment
/**
@@ -184,7 +188,8 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void processingInstruction(String target, XMLString data)
+ public void processingInstruction(String target, XMLString data,
+ Augmentations augmentations)
throws XNIException {
} // processingInstruction
@@ -193,7 +198,8 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void startExternalSubset() throws XNIException {
+ public void startExternalSubset(XMLResourceIdentifier identifier,
+ Augmentations augmentations) throws XNIException {
} // startExternalSubset
/**
@@ -201,7 +207,7 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void endExternalSubset() throws XNIException {
+ public void endExternalSubset(Augmentations augmentations) throws XNIException {
} // endExternalSubset
/**
@@ -212,7 +218,8 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void elementDecl(String name, String contentModel)
+ public void elementDecl(String name, String contentModel,
+ Augmentations augmentations)
throws XNIException {
} // elementDecl
@@ -224,7 +231,8 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void startAttlist(String elementName) throws XNIException {
+ public void startAttlist(String elementName,
+ Augmentations augmentations) throws XNIException {
} // startAttlist
/**
@@ -248,7 +256,10 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void attributeDecl(String elementName, String attributeName, String type, String[] enumeration, String defaultType, XMLString defaultValue)
+ public void attributeDecl(String elementName, String attributeName,
+ String type, String[] enumeration,
+ String defaultType, XMLString defaultValue,
+ XMLString nonNormalizedDefaultValue, Augmentations augmentations)
throws XNIException {
} // attributeDecl
@@ -257,7 +268,7 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void endAttlist() throws XNIException {
+ public void endAttlist(Augmentations augmentations) throws XNIException {
} // endAttlist
/**
@@ -275,7 +286,8 @@
* @throws XNIException Thrown by handler to signal an error.
*/
public void internalEntityDecl(String name, XMLString text,
- XMLString nonNormalizedText)
+ XMLString nonNormalizedText,
+ Augmentations augmentations)
throws XNIException {
} // internalEntityDecl(String,XMLString,XMLString)
@@ -291,7 +303,9 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void externalEntityDecl(String name, String publicId, String systemId)
+ public void externalEntityDecl(String name,
+ XMLResourceIdentifier identifier,
+ Augmentations augmentations)
throws XNIException {
} // externalEntityDecl
@@ -307,7 +321,9 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void unparsedEntityDecl(String name, String publicId, String systemId, String notation)
+ public void unparsedEntityDecl(String name,
+ XMLResourceIdentifier identifier,
+ String notation, Augmentations augmentations)
throws XNIException {
} // unparsedEntityDecl
@@ -322,7 +338,8 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void notationDecl(String name, String publicId, String systemId)
+ public void notationDecl(String name, XMLResourceIdentifier identifier,
+ Augmentations augmentations)
throws XNIException {
} // notationDecl
@@ -337,7 +354,7 @@
* @see XMLDTDHandler#CONDITIONAL_INCLUDE
* @see XMLDTDHandler#CONDITIONAL_IGNORE
*/
- public void startConditional(short type) throws XNIException {
+ public void startConditional(short type, Augmentations augmentations) throws XNIException {
} // startConditional
/**
@@ -345,7 +362,7 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void endConditional() throws XNIException {
+ public void endConditional(Augmentations augmentations) throws XNIException {
} // endConditional
/**
@@ -353,7 +370,7 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void endDTD() throws XNIException {
+ public void endDTD(Augmentations augmentations) throws XNIException {
} // endDTD
/**
@@ -369,7 +386,7 @@
*
* @throws XNIException Thrown by handler to signal an error.
*/
- public void endEntity(String name) throws XNIException {
+ public void endEntity(String name, Augmentations augmentations) throws XNIException {
}
//
1.10 +10 -7 xml-xerces/java/src/org/apache/xerces/xni/XMLDTDHandler.java
Index: XMLDTDHandler.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xni/XMLDTDHandler.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XMLDTDHandler.java 29 Jan 2002 20:44:03 -0000 1.9
+++ XMLDTDHandler.java 7 May 2002 19:29:04 -0000 1.10
@@ -67,7 +67,7 @@
*
* @author Andy Clark, IBM
*
- * @version $Id: XMLDTDHandler.java,v 1.9 2002/01/29 20:44:03 neilg Exp $
+ * @version $Id: XMLDTDHandler.java,v 1.10 2002/05/07 19:29:04 elena Exp $
*/
public interface XMLDTDHandler {
@@ -162,13 +162,16 @@
/**
* The start of the DTD external subset.
- *
- * @param augmentations Additional information that may include infoset
- * augmentations.
- *
- * @throws XNIException Thrown by handler to signal an error.
+ *
+ * @param identifier The resource identifier.
+ * @param augmentations
+ * Additional information that may include infoset
+ * augmentations.
+ * @exception XNIException
+ * Thrown by handler to signal an error.
*/
- public void startExternalSubset(Augmentations augmentations)
+ public void startExternalSubset(XMLResourceIdentifier identifier,
+ Augmentations augmentations)
throws XNIException;
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org