xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud Le Hors <leh...@us.ibm.com>
Subject Re: Another question about using Xerces
Date Wed, 01 Mar 2000 18:02:08 GMT
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");

Since a Document can only have one element child, trying to add any
other raises an exception.

Arnaud  Le Hors - IBM Cupertino, XML Technology Group

View raw message