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

Streaming XMLs from reader to writer changes namespace name

    XMLWordPrintable

Details

    • 5
    • 13f673939 (dev), a92db9d5f (6.6), fac706849 (6.5)
    • Foundation Sprint 86, Foundation Sprint 87, Foundation Sprint 88, Foundation Sprint 89, Foundation Sprint 90, Foundation Sprint 91

    Description

      Scenario: reading an xml file with QXmlStreamReader and writing every (unmodified) token to another file with QXmlStreamWriter.

       

      QString streamXML(QString const& xmlIn)
      {
       QString xmlOut;
      QXmlStreamReader reader(xmlIn);
       QXmlStreamWriter writer(&xmlOut);
      while (!reader.atEnd()) {
       reader.readNext();
       writer.writeCurrentToken(reader);
       }
      return xmlOut;
      }
      streamXML(QString("<?xml version='1.0'?><abc:elem1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:abc='ns1' />"));
      

      The output is:

      <?xml version="1.0"?><n1:elem1 xmlns:n1="ns1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abc="ns1"/>
      

      Please note, that the namespace is renamed and doubled.

      Instead of:

      <?xml version="1.0"?><abc:elem1 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abc="ns1"/>
      
      

      This issue was caused by the changes for https://bugreports.qt.io/browse/QTBUG-63434

      I already patched my local qt sources with a fix, but I'm not aware of the check in process, therefore i have appended my patchfile.

      Please review my patch and check it in. The issue will occur with most XML files using namespaces that's why i think it has important priority.

      Attachments

        For Gerrit Dashboard: QTBUG-75456
        # Subject Branch Project Status CR V

        Activity

          People

            oyheskes Øystein Heskestad
            jens_moeller Jens Moeller
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes