Hi
Find the attached file as code for bug #3439.
Cheers,
Arun Yadav
SUN Microsystems,India
Index: AbstractDOMParser.java
===================================================================
RCS file:
/home/cvspublic/xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java,v
retrieving revision 1.1.2.13
diff -u -w -r1.1.2.13 AbstractDOMParser.java
--- AbstractDOMParser.java 2001/07/30 08:39:33 1.1.2.13
+++ AbstractDOMParser.java 2001/09/07 14:24:21
@@ -60,7 +60,11 @@
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xerces.dom.EntityReferenceImpl;
import org.apache.xerces.dom.TextImpl;
+import org.apache.xerces.dom.DocumentTypeImpl;
+import org.apache.xerces.dom.NotationImpl;
+import org.apache.xerces.dom.EntityImpl;
+
import org.apache.xerces.xni.QName;
import org.apache.xerces.xni.XMLAttributes;
import org.apache.xerces.xni.XMLLocator;
@@ -79,6 +83,11 @@
import org.w3c.dom.Node;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.Text;
+import org.w3c.dom.Notation;
+
+
+
+
/**
* This is the base class of all DOM parsers. It implements the XNI
@@ -130,6 +139,12 @@
/** The default Xerces document implementation, if used. */
protected DocumentImpl fDocumentImpl;
+ /** The documenttype. */
+ protected DocumentType fDocumentType;
+
+ /** The Xerces documenttype implementation, if used. */
+ protected DocumentTypeImpl fDocumentTypeImpl;
+
/** Current node. */
protected Node fCurrentNode;
@@ -138,6 +153,7 @@
/** True if inside document. */
protected boolean fInDocument;
+
/** True if inside CDATA section. */
protected boolean fInCDATASection;
@@ -259,6 +275,91 @@
} // comment(XMLString)
/**
+ * A notation declaration
+ *
+ * @param name The name of the notation.
+ * @param publicId The public identifier of the notation, or null if not
+ * specified.
+ * @param systemId The system identifier of the notation, or null if not
+ * specified.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void notationDecl(String name, String publicId, String systemId)throws
+XNIException {
+ NotationImpl notation=(NotationImpl)fDocumentImpl.createNotation(name);
+ notation.setPublicId(publicId);
+ notation.setSystemId(systemId);
+ fDocumentTypeImpl.getNotations().setNamedItem(notation);
+
+ } // notation
+
+ /**
+ * An internal entity declaration.
+ *
+ * @param name The name of the entity. Parameter entity names start with
+ * '%', whereas the name of a general entity is just the
+ * entity name.
+ * @param text The value of the entity.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void internalEntityDecl(String name, XMLString text)
+ throws XNIException {
+ EntityImpl entity=(EntityImpl)fDocumentImpl.createEntity(name);
+ fDocumentTypeImpl.getEntities().setNamedItem(entity);
+
+ } // internalEntityDecl(String,XMLString)
+
+
+ /**
+ * An external entity declaration.
+ *
+ * @param name The name of the entity. Parameter entity names start
+ * with '%', whereas the name of a general entity is just
+ * the entity name.
+ * @param publicId The public identifier of the entity or null if the
+ * the entity was specified with SYSTEM.
+ * @param systemId The system identifier of the entity.
+ * @param baseSystemId The base system identifier where this entity
+ * is declared.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void externalEntityDecl(String name,
+ String publicId, String systemId,
+ String baseSystemId) throws XNIException {
+ EntityImpl entity=(EntityImpl)fDocumentImpl.createEntity(name);
+ entity.setPublicId(publicId);
+ entity.setSystemId(systemId);
+ fDocumentTypeImpl.getEntities().setNamedItem(entity);
+
+ } // externalEntityDecl(String,String,String,String)
+
+
+ /**
+ * An unparsed entity declaration.
+ *
+ * @param name The name of the entity.
+ * @param publicId The public identifier of the entity, or null if not
+ * specified.
+ * @param systemId The system identifier of the entity, or null if not
+ * specified.
+ * @param notation The name of the notation.
+ *
+ * @throws XNIException Thrown by handler to signal an error.
+ */
+ public void unparsedEntityDecl(String name,
+ String publicId, String systemId,
+ String notation) throws XNIException {
+ EntityImpl entity=(EntityImpl)fDocumentImpl.createEntity(name);
+ entity.setPublicId(publicId);
+ entity.setSystemId(systemId);
+ entity.setNotationName(notation);
+ fDocumentTypeImpl.getEntities().setNamedItem(entity);
+
+ } // unparsedEntityDecl(String,String,String,String)
+
+ /**
* A processing instruction. Processing instructions consist of a
* target name and, optionally, text data. The data is only meaningful
* to the application.
@@ -323,6 +424,8 @@
DocumentImpl docimpl = (DocumentImpl)fDocument;
DocumentType doctype = docimpl.createDocumentType(rootElement, publicId,
systemId);
+ fDocumentType=doctype;
+ fDocumentTypeImpl=(DocumentTypeImpl)doctype;
fCurrentNode.appendChild(doctype);
} // doctypeDecl(String,String,String)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]