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

QXmlStreamNamespaceDeclarations returning invalid prefix and namespaceUri

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 4.4.3
    • None
    • Microsoft Visual Studio 2005. Windows 7 64 bit. Virtual Machine (VMFusion on a power MAC).

    Description

      Here's a small code sample. Assume doc is a QXmlStreamReader in progress of reading, and I'm already started reading the xml document. I'm at the starting element of the very first element of the document:
      {{{

      if (doc.name() == "WFS_Capabilities")
      {
      for (QXmlStreamNamespaceDeclarations::iterator it = doc.namespaceDeclarations().begin(); it != doc.namespaceDeclarations().end(); ++it)

      { QString prefix, namespaceUri; prefix = it->prefix().size() > 0 ? it->prefix().toString() : ""; namespaceUri = it->namespaceUri().size() > 0 ? it->namespaceUri().toString() : ""; }

      }

      }}}

      This loop is getting called on the root element. Here's an example root element that I'm using:

      <WFS_Capabilities xmlns="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-capabilities.xsd" version="1.0.0">

      I first tried to pull the values straight from the iterator, but the program crashes when I try to convert the QStringRef->toString(). I even tried to use the isNull() and isEmpty() function checks, but it passes the checks, then the program crashes. The memory underneath QStringRef seems random, and garbage.

      Is there any way I can retrieve the namespaces from the xml head element using QXmlStreamReader without the program crashing? Thanks.

      Attachments

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

        Activity

          People

            pamatila Pasi Matilainen (Inactive)
            atemple Adam Temple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes