Search code examples
c++xmlprintingxerces-c

Printing an XML Document in Xerces-C


My problem is simple. I have a XercesDOMParser, so I can access through getDocument() to the DOMDocument stored in it.

I want to get the xml string representing the tree.

What is the correct call? I assume a valid operator/function is provided by the library.


Solution

  • It's some time since I used Xerces-C but I would look at http://xerces.apache.org/xerces-c/apiDocs-2/classDOMWriter.html This takes care of the encoding and other problems (which are easy to overlook).

    I'd look first at

    virtual XMLCh *     writeToString (const DOMNode &nodeToWrite)=0
        Serialize the specified node as described above in the description of DOMWriter.