Andy Fish wrote:
> I am wondering what is the "most standard" way of creating a brand new empty
> document in DOM. I'm working in java using xerces but I would like to make
> the code as portable as possible. I have found 2 ways of doing it:
>
> 1. new DOMImplementationImpl().createDocument(...);
> 2. new DocumentImpl();
>
> but both these are in org.apache.xerces.
>
> Any reason I should prefer one over the other? any better way of doing it?
The Sun 1.4 SDK has
javax.xml.parsers.DocumentBuilder
which you should create using the factory
javax.xml.parsers.DocumentBuilderFactory
and then you can call
getDOMImplementation()
on the document builder and on the returned object you can call the W3C
DOM Level 2
createDocument(...)
--
Martin Honnen
http://JavaScript.FAQTs.com/