You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Ken Ore <Ke...@inso.com> on 2001/02/12 21:17:41 UTC

Easiest way to *create* an XML document as a *byte stream*


Hello all,

>From the sample program CreateDOMDocument, I gather that I need to use
DOM_DOMImplementation to create a DOM document and use
DOM_Element::createElement and
DOM_Element::appendChild to create the composition.  To transform this into a
stream of bytes with the xml as text it looks to me like I have these options:

a) create a containing class for DOM_Element, and for each create and append
write it out to a buffer
b) use DOM_Document::createNodeIterator, and for each node indent appropriately
and print out the appropriate information from the node, e.g. attributes.

Thanks, and apologies if I've missed this topic in the FAQ or elsewhere...  I do
realize first and foremost that xerces is a parser, but since most of the xml
creation code is there,
I'd like to take advantage of it.

     Ken