Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-8158

QDomDocument save reorders attributes

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Invalid
    • Affects Version/s: 4.5.2
    • Fix Version/s: None
    • Component/s: XML: DOM
    • Labels:
      None
    • Environment:
      MacBook Pro
      Windows Vista
      Microsoft Visual Studio 2008

      Description

      Saving a QDomDocument to file sometimes results in its elements' attributes being reordered.

      e.g. the XML attributes in this QString:

      <root name="fred">
         <element1 c="a" d="b" f="c"/ >
      </root>
      

      get reordered to:

      <root name="fred" >
         <element1 f="c" c="a" d="b" />
      </root>
      

      The following code demonstrates:

      QString xml = "<root name=\"fred\"><element1 c=\"a\" d=\"b\" f=\"c\"/></root>";
               
      QDomDocument* domDoc = new QDomDocument;
      domDoc->setContent(xml, false);
      
      QFile file("temp.xml");
      if(!file.open(QFile::WriteOnly))
         return;
              
      QTextStream out(&file);
      domDoc->save(out, 3);
      

      See also Qt bug 5364. The patch looks specific to that problem though.

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                rsibley77 Robin Sibley
              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes