Important: Please read the Qt Code of Conduct -

DOMLSSerializer (from Xerces-C++ 3.0) on QtXML

  • On Xerces-C++ 3.0 we can do something like:
    DOMLSSerializer* serializer = ((DOMImplementationLS*)impl)->createLSSerializer();
    if (serializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTDiscardDefaultContent, true)) {
    serializer->getDomConfig()->setParameter(XMLUni::fgDOMWRTDiscardDefaultContent, true);

    if (serializer->getDomConfig()->canSetParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true)){
        serializer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
     XMLFormatTarget *myFormTarget = new LocalFileFormatTarget(strFileName.c_str());
     DOMLSOutput* theOutput = ((DOMImplementationLS*)impl)->createLSOutput();
     serializer->write(delemConfig, theOutput);


    What would be the corresponding API using QtXML?
    I'm porting a code from Xerces to QtXML but sometimes it is hard to find a direct mapping from one API to the other...

    On this example, even if I were using the old Xerces-C++ 2.0 API with DOMWriter::writeNode I still wouldn't be able to find the mapping on Qt.

    thanks in advance!

  • I am not familiar with Xerces, and I don't know what the code above does exactly. But, did you take a look at that QXmlStreamWriter class?

Log in to reply