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

QDomDocument.setContent() silently fails on duplicated attributes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.2.3
    • Fix Version/s: None
    • Component/s: XML: DOM
    • Labels:
      None
    • Environment:
      Qt 6.2.3 on Mac running version 10.15.7 Catalina of MacOs. Reference environment for comparison: KUbuntu 20.04 with Qt 5.12.8
    • Platform/s:
      macOS

      Description

      When reading the attached example XML file test_bug.xml with the following code, line 12 with two identical "type" attributes silently stops the processing for the rest of the file (see output log_mac1.xml) and checking the return code of setContent() does not hint that anything went wrong:

       

      xml_.setContent(&file, false, &error_msg, &error_line, &error_column);
      qDebug() << getXml().toString();

      If I comment out this line, the output of toString is as expected (the same as the input, except for the random reordering of the attributes, see output log_mac2.xml). When running this on  Linux with Qt5.12.8, the problem does not appear (ie the whole file is processed in all cases).

       

        Attachments

        1. test_bug.xml
          1 kB
        2. log_mac1.xml
          0.4 kB
        3. log_mac2.xml
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            bavay Mathias Bavay
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes