Controlling DOM escape sequences



  • I'm using XML for saving and loading my application data. I started with QXmlStreamReader and QXmlStreamWriter. When writing the data, it escaped quotes, angle brackets, and things I would expect. Now, I've switched everything over to the QDomDocument model (for easier object-level serialization), and the end result has newlines escaped.

    The newlines were not escaped with QXmlStreamWriter, and I was happy with that. First, why the difference between the two? Second, is there any way I can control what gets escaped when and how?


  • Lifetime Qt Champion

    Hi,

    QDomDocument is an old API that's been deprecated in favor of QXmlStreamReader/Writer.

    The document handling is different. As it implies QDomDocument is a DOM implementation while QXmlStreamXXXX is SAX.

    Hope it helps



  • I've tried XML object serialization a few different ways, and DOM elements is the one I've found to work best for my needs. DOM and SAX each apply well to different applications, in my opinion.

    My question is more about how to keep the DOM document from saving carriage returns as 
 in my file. However, if there is a good example of encapsulated object serialization using QXmlStream*, I'm very interested in that, too.

    Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.