Hi, 

Please find the attached patch for AbstractDOMParser. 

AbstractDOMParser as of now doesn't provide  the implementation for Notation and 
Entity Nodes. I have implemented the notation, internalentity, externatentity 
and unparedentity method in AbstractDOMPaser. Currently,it doesn't take care of 
Derferred DOM. After implementing above changes, domunit.jar is reporting   7 
failures and 0 errors out of 25 failures and 10 errors.
        I will submit the patch for remaining failures soon.

Cheers,
Arun

Sun Microsystem,Inc.


Curt Arnold wrote:
> Glad XML conformance is getting there.  However, the results of (unofficial)
> DOM conformance testing are still looking like a serious regression from
> Xerces-J 1.
> 
> Running the domunit.jar tests from xmlconf report 25 test failures where
> Xerces-J 1 had 0.  It looks like DocumentType.getEntities() and
> DocumentType.getNotation() are returning zero length lists when there are
> entities and notations declared in the DTD causing all entity and  notation
> related tests to fail.
> 
> To run domunit, download
> http://prdownloads.sourceforge.net/xmlconf/domunit-0.0.6.zip, unzip and
> place junit.jar (http://www.junit.org) and xerces.jar in same directory and
> java -jar domunit.jar.
> 
> Things get worse with the in-development W3C DOM test for Level 1 core where
> the first pass shows similar results to domunit, however the second pass,
> where options like ignoreElementContentWhitespace, expandEntityReferences,
> etc are changed from their non-default values has almost all tests failing.
> The most likely cause of this (due to the number of tests effected) is the
> ignoreElementContentWhitespace attribute being either ignored or differently
> implemented.
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/10/24 07:07:51
@@ -60,6 +60,8 @@
 import org.apache.xerces.dom.DocumentImpl;
 import org.apache.xerces.dom.EntityReferenceImpl;
 import org.apache.xerces.dom.TextImpl;
+import org.apache.xerces.dom.NotationImpl;
+import org.apache.xerces.dom.EntityImpl;
 
 import org.apache.xerces.xni.QName;
 import org.apache.xerces.xni.XMLAttributes;
@@ -130,6 +132,9 @@
     /** The default Xerces document implementation, if used. */
     protected DocumentImpl fDocumentImpl;
 
+    /** The documenttype. */
+    protected DocumentType fDocumentType;
+
     /** Current node. */
     protected Node fCurrentNode;
 
@@ -259,6 +264,96 @@
     } // 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 {
+        if(fDocumentType.getNotations().getNamedItem(name)==null){
+            NotationImpl notation=(NotationImpl)fDocumentImpl.createNotation(name);
+            notation.setPublicId(publicId);
+            notation.setSystemId(systemId);
+            fDocumentType.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 {
+        if(fDocumentType.getEntities().getNamedItem(name)==null && 
+!name.startsWith("%")){
+            EntityImpl entity=(EntityImpl)fDocumentImpl.createEntity(name);
+            fDocumentType.getEntities().setNamedItem(entity);
+        }
+        //System.out.println("ssds");
+
+    } // 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 {
+        if(fDocumentType.getEntities().getNamedItem(name)==null){
+            EntityImpl entity=(EntityImpl)fDocumentImpl.createEntity(name);
+            entity.setPublicId(publicId);
+            entity.setSystemId(systemId);
+            fDocumentType.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 {
+        if(fDocumentType.getEntities().getNamedItem(name)==null){
+            EntityImpl entity=(EntityImpl)fDocumentImpl.createEntity(name);
+            entity.setPublicId(publicId);
+            entity.setSystemId(systemId);
+            entity.setNotationName(notation);
+            fDocumentType.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.
@@ -322,8 +417,8 @@
         throws XNIException {
         
         DocumentImpl docimpl = (DocumentImpl)fDocument;
-        DocumentType doctype = docimpl.createDocumentType(rootElement, publicId, 
systemId);
-        fCurrentNode.appendChild(doctype);
+        fDocumentType = docimpl.createDocumentType(rootElement, publicId, systemId);
+        fCurrentNode.appendChild(fDocumentType);
 
     } // doctypeDecl(String,String,String)
 
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to