xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Hodges <harmo...@swbell.net>
Subject How to deal with differences in DOM implementations?
Date Fri, 03 Mar 2000 18:46:56 GMT
I'm curious how people are dealing with the differences in DOM implementations.  I started
out with OpenXML, then switched to Xerces, now I'm trying to support JAXP as well.  JAXP is
Sun's DOM implementation.

For instance, in JAXP, here's their example of how to create an element and add it to a document:

 Document doc = db.newDocument ();
 Element root = doc.createElement ("root");
 Attr  tmp;
 Writer  out = new OutputStreamWriter (System.out);

 doc.appendChild (root);

In Xerces, this produces an exception.  The last line must be changed to:

doc.getDocumentElement().appendChild(root);

If the same change is applied to JAXP, getDocumentElement() returns a null, since the document
is empty.

This is a bit troubling.  I had hoped to support different implementations of the DOM.


Mime
View raw message