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:32:55 GMT

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


> Eric Hodges wrote:
> >
> > ----- Original Message -----
> > From: "Arnaud Le Hors" <lehors@us.ibm.com>
> > To: <general@xml.apache.org>
> > Sent: Friday, March 03, 2000 4:56 PM
> > Subject: Re: How to deal with differences in DOM implementations?
> >
> > > You should actually be able to do the following:
> > >
> > > Document doc = new org.apache.xerces.dom.DocumentImpl();
> > >
> > > and proceed with the appendChild as you do with the Sun DOM.
> >
> > I tried that several days ago.  It didn't work (I was using Xerces
1.0.1).
> > I was told on this list I needed to get the documentElement from the
> > document and append my children to it.  Sun creates their Document
without a
> > documentElement.  The first child added becomes the documentElement, I
> > believe.  Apache creates one along with the document.
>
> I do it with that new org.apache.xerces.dom.DocumentImpl(), and it
> works.

I was using DOMImplementationImpl.  Here's the example I got from Arnaud Le
Hors:

>  public XercesTest() {
>     DOMImplementationImpl imp = new DOMImplementationImpl();
>     Document doc = imp.createDocument(null, "Test", null);
>     Element e = doc.createElement("dummElement");
>     doc.getDocumentElement().appendChild(e);
>   }



Mime
View raw message