xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wong Kok Wai <won...@pacific.net.sg>
Subject Re: How to deal with differences in DOM implementations?
Date Sat, 04 Mar 2000 00:43:24 GMT
Maybe this will work for both DOM implementations:

Element root = doc.getDocumentElement();
if (root == null) {
  root = doc.createElement("root-name");
  doc.appendChild(root);
}


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.


Mime
View raw message