xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierpaolo Fumagalli <p...@apache.org>
Subject Re: How to deal with differences in DOM implementations?
Date Fri, 03 Mar 2000 22:46:44 GMT
> Eric Hodges wrote:
> 
> 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.

No it's not... Go and read JAXP spec: http://java.sun/com/xml
And we're complianto to what the JAXP specification says.

> 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);

This is wrong... And it must be a XERCES bug, even if in all the time I
worked w/ Xerces, I never had to do something like it... What version
are you using?

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

That should be the right behaviour.

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

The dom implementation should be completely transparent from the
application point of view...  AFAIK I never had any problem on that
apart from some specific DOM2 features (that are not yet standard...)

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<mailto:pier@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------



Mime
View raw message