"Jason E. Stewart" wrote:
> 
> "Murray Cumming" <[EMAIL PROTECTED]> writes:
> 
> > I'm trying to use the DOMPrint code to ouput the text of a DOM_Document
> > that was constructed entirely in memory by adding nodes. Unlike the
> > DOMPrint example, this DOM_Document was never parsed from XML text.
> >
> > I find that the declaration text at the start is never written. I mean
> > this type of stuff:
> >
> > <?xml version='1.0' encoding='ISO-8859-1' ?>
> > <!DOCTYPE cacs_configuration SYSTEM "cacs_configuration.dtd">
> >
> > I've tried using DOM_Document::createXMLDecl(), and
> > DOM_Document::createDocumentType(), but they don't seem to have any
> > effect. Can anyone give me any clues?
> 
> Murray,
> 
> Are you using DOM_DOMImplementation::getImplementation() ?
> 
> This is the interface I use. Pardon the Perl code, but the interface
> is the same:
> 
> $impl = XML::Xerces::DOM_DOMImplementation::getImplementation();
> $dt = $impl->createDocumentType('Foo', '', 'Foo.dtd');
> $doc = $impl->createDocument('Foo', 'foo',$dt);

That did it. I was using DOM_Document::createDocumentType() instead of
DOM_DOMImplementation::createDocumentType(). I'm not sure why the first
one exists, as you generally need a DocumentType before creating the
Document.

At least in C++, it's unnecessary to use
DOM_DOMImplementation::getImplementation(). The DOM_DOMImplementation
constructor is enough.

Thanks.

-- 
Murray Cumming
www.murrayc.com
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to