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

QDomDocument save reorders attributes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 4.5.2
    • XML: DOM
    • None
    • 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

              Unassigned Unassigned
              rsibley77 Robin Sibley
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes