Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Controlling DOM escape sequences

Controlling DOM escape sequences

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jkdoug
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jkdoug
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved