That did the trick for the DOCTYPE declaration, but I still don't have an
<?xml?> processing instruction.
I'm building a DOM tree in memory, then writing it to disk using code
snitched from DOMPrint. All the nodes and now the doctype declaration are
output just fine (thanks again), but there is no <?xml ...?> line at the top
of the xml file.
--
Jeff Paquette
paquette at mediaone.net
http://www.atnetsend.net
> -----Original Message-----
> From: Wyles Eric - ewyles [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 08, 2001 5:22 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: how to create processing node and dtd reference?
>
>
> Hi Jeff,
>
> I was able to get the DOCTYPE by doing something like the
> following (notice
> that it is my doctype instance being passed into createDocument():
> DOM_DOMImplementation impl;
> DOM_Document doc;
> DOM_DocumentType doctype;
>
> //create the document type
> doctype = impl.createDocumentType(DOMString("RootElementName"),
>
> NULL,
>
> DOMString("DTDFile.dtd"));
> //create the document
> doc = impl.createDocument(
> 0,
> "RootElementName",
> doctype);
>
> As for the XML declaration, I have been able to use the DOMPrint
> example and
> send in my "doc" variable (see above) and it will print out the xml
> declaration. I'm not sure that is really what you are wanting to
> do though.
> Are you wanting to print it out or have it as part of your dom tree in
> memory?
>
>
> Hope that helps
>
>
> -----Original Message-----
> From: Jeff Paquette [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 08, 2001 4:10 PM
> To: [EMAIL PROTECTED]
> Subject: how to create processing node and dtd reference?
>
>
> Hi,
>
> I'm new to xml and xerces. I am trying to generate an xml file from a
> database and have been able to generate well-formed xml using xerces, but
> the file does not have a DOCTYPE declaration nor the <?xml?> processing
> instruction.
>
> I've managed to get a DOCTYPE declaration generated, but it's ugly:
>
> DOM_DOMImplementation impl;
>
> DOM_Document xmlDoc_dummy = impl.createDocument(
> 0, // root element namespace URI.
> "dummy", // root element name
> DOM_DocumentType()); // document type object (DTD).
>
>
> DOM_DocumentType dtd;
> dtd = xmlDoc_dummy.createDocumentType("mynode SYSTEM \"my.dtd\"");
>
> DOM_Document xmlDoc = impl.createDocument(
> 0, // root element namespace URI.
> "mynode", // root element name
> dtd); // document type object (DTD).
>
>
> But when I use either
> createXMLDecl("1.0", "UTF-16", "no");
> or
> createProcessingInstruction("xml", "version='1.0' encoding='UTF-16'
> standalone='no'")
>
> neither appear in the tree, unless I either appendChild() (it is output at
> the end of the document) or insertBefore(,
> xmlDoc.getDocumentElement() (the
> processing instruction is now before the data, but after the dtd!
>
> Any help would be greatly appreciated.
>
> BTW: it was nearly impossible doing this using MSXML too. But I did find a
> way.
> --
> Jeff Paquette
> paquette at mediaone.net
> http://www.atnetsend.net
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]