xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Hodges <harmo...@swbell.net>
Subject Re: How to deal with differences in DOM implementations?
Date Mon, 06 Mar 2000 19:28:48 GMT

----- Original Message -----
From: Pierpaolo Fumagalli <pier@apache.org>
To: <general@xml.apache.org>
Sent: Friday, March 03, 2000 4:46 PM
Subject: Re: How to deal with differences in DOM implementations?


> > 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.

OK, I misunderstood.  The JAXP that Sun provides includes some
implementation of DOM level 1 and SAX.  That's what I meant.

>
> > 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?

I'm using 1.0.2, the latest version I could find.  According to Arnaud Le
Hors this is the result of Xerces implementing the DOM level 2 spec.
Apparently DOM 1 and DOM 2 don't coexist well.

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

How do I get the Xerces implementation of JAXP?



Mime
View raw message