W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2000

Re: creating XML document from scratch

From: Philippe Le Hegaret <plh@w3.org>
Date: Tue, 30 May 2000 15:12:38 -0400
Message-ID: <393412A6.2252E221@w3.org>
To: Heather Lindsay <heather.lindsay@Trifolium.com>
CC: "'www-dom@w3.org'" <www-dom@w3.org>
Heather Lindsay wrote:
> 
> hi,
>         I want to create a DOM document without originally having an XML
> document.  So, instead of parsing an XML document and getting the DOM
> document, I want to just create an empty DOM document and then fill in
> whatever elements, etc. that I need.  After extensive searching through Java
> docs (Xerces implementation), it seems that creating a document from scratch
> is not possible using the DOM.  Is this true or am I misunderstanding the
> documentation?  I'm sorry if this question has already been answered in FAQ
> or the archives but I could not find anything in either source and I just
> joined this list.  Any help or clarification would be greatly appreciated.

I'm not an expert in Xerces but you should be allowed to get a DOMImplementation
object (see org.apache.xerces.dom.DOMImplementationImpl.getDOMImplementation())
Using this object, you can use the createDocument method to create a DOM
Document:
http://www.w3.org/TR/DOM-Level-2/core.html#Level-2-Core-DOM-createDocument

Note:
- Since DOM Level 2 is not a recommendation yet, the implementation
of DOM Level 2 in Xerces is still in beta stage.
- DOMImplementationImpl is not an official DOM method. The bootstrapping problem
in Java will be resolved in DOM Level 3.

Philippe
Received on Tuesday, 30 May 2000 15:12:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT