xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Hodges <harmo...@swbell.net>
Subject Re: Another question about using Xerces
Date Wed, 01 Mar 2000 19:33:29 GMT
Ah, thanks.  I've never seen that spec before, and I've been to W3.org many
times.

Does anyone know why Document has an appendChild method if it can't have
children?  Is it just a bad interface hierarchy?


----- Original Message -----
From: Arnaud Le Hors <lehors@us.ibm.com>
To: <general@xml.apache.org>
Sent: Wednesday, March 01, 2000 12:02 PM
Subject: Re: Another question about using Xerces


> As defined in the spec [1] createDocument() not only create the Document
> node but also the root element (also called "document element"). So you
> need to start adding elements to the root element and not to the
> Document itself. Try:
>
>  public XercesTest() {
>     DOMImplementationImpl imp = new DOMImplementationImpl();
>     Document doc = imp.createDocument(null, "Test", null);
>     Element e = doc.createElement("dummElement");
>     doc.getDocumentElement().appendChild(e);
>   }
>
> Since a Document can only have one element child, trying to add any
> other raises an exception.
>
> [1]
>
http://www.w3.org/TR/1999/CR-DOM-Level-2-19991210/core.html#Level-2-Core-DOM
-createDocument
> --
> Arnaud  Le Hors - IBM Cupertino, XML Technology Group


Mime
View raw message