You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Swanson, Brion" <Br...@westgroup.com> on 2001/02/28 15:03:10 UTC

BUG in DOMImplementationImpl??

It appears that DOMImplementationImpl.createDocumentType () does not behave
in the same manner as DocumentTypeImpl () - it seems that they should and
that this may be a bug in xerces.

DocumentTypeImpl () will take an owner document and three strings to create
a DocumentType node. On the other hand,
DOMImplementationImpl.createDocumentType () takes only the three strings
(qualifiedName, publicID, and systemID).

DocumentTypeImpl can correctly create a document type node given three nulls
and a system ID.  DOMImplementationImpl cannot create a document type node
unless each of the three strings is a non-null, non-empty string.

Example:
// this works - it creates a document type with SYSTEM = "uri://foo"
DocumentType goodDoctype = new DocumentTypeImpl (null, null, null,
                                                 "uri://foo");

// this does not work
DOMImplementationImpl dom = new DOMImplementation ();
DocumentType badDoctype = dom.createDocumentType (null, null, 
                                                  "uri://foo");
// it dies with this exception
org.apache.xerces.dom.DOMExceptionImpl: DOM002 Illegal character
        at
org.apache.xerces.dom.DOMImplementationImpl.createDocumentType(DOMImplementa
tionImpl.java:150)
<snip/>

// This doesn't work either...
DocumentType badToo = dom.createDocumentType ("", "", "uri://foo");

// it dies with a different exception
java.lang.ArrayIndexOutOfBoundsException
        at
org.apache.xerces.dom.DocumentImpl.isXMLName(DocumentImpl.java:1315)
        at
org.apache.xerces.dom.DOMImplementationImpl.createDocumentType(DOMImplementa
tionImpl.java:149)
<snip/>