The new API for document creation in DOM level 2 is not quite as succinct as
the old static createDocument() method from the Xerces-c DOM level 1
implementation, but it's not quite as bad as all that.
Here's some sample code, taken from the CreateDOMDocument sample included
with Xerces 1.1,
DOM_DOMImplementation impl;
DOM_Document doc = impl.createDocument(
0, // root element namespace URI.
"company", // root element name
DOM_DocumentType()); // document type object (DTD).
The old method will stay around for a while, for compatibility purposes, but
any new code should use the new DOM_DOMImplementation::createDocument()
function.
-- Andy
----- Original Message -----
From: "Blaine Brodie" <[EMAIL PROTECTED]>
> In the xerces-c DOM_Document interface, I noticed that there was a static
> factory method called createDocument. The comment with this function
> states that it was added because
> the DOM API lacks a mechanism for the creation of new documents. However
> the DOM2 spec. now has a createDocument function in the
> DOM_DOMImplementation interface which takes in a name space URI, qualified
> name and document type parameters, but is not static. To use this new
> createDocument function without a reference to an existing
> DOMImplementation, one must use something similar to the following:
>
> DOM_Document d =
>
DOM_Document::createDocument().getDOMImplementation().createDocument(nsURI,
> qn, dt);
>
> This seems unintuitive. Are there any plans to either make the new
> createDocument static and/or move the old DOM_Document factory method over
> to DOM_DOMImplementation?
>