Daniel Burrell wrote:
So I understand it is possible to parse an xml file from a location on disk
using:
parser->parse(gXmlFile);
where gXmlFile is the file location.

I would like to serialise the contents of dom to 'memory' rather than disk,
then parse it back in from memory

Is this possible?

In order to save to memory, you can use DOMWriter::writeToString (that always saves using UTF-16) or DOMWriter::writeNode using as XMLFormatTarget an instance of MemBufFormatTarget (in this case, the encoding can be specified using DOMWriter::setEncoding). As for loading back from the memory buffer, you can use the parse(InputSource&) overload, using a MemBufInputSource object wrapping your data.

Alberto

Reply via email to