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

QXmlStreamWriter asserts URI is not null, but according to the standard it can

    XMLWordPrintable

Details

    • af70d4ee85246031ff631488a9191034bf3baa7a

    Description

      W3C Namespaces Standard states that "The attribute value in a default namespace declaration MAY be empty" (secion 6.2).

      QXmlStreamWriter asserts that it is not emtpy, causing a failure in debug mode (therefore undefined behavior in release?) every time the xlmns attribute is an empty string:

      ASSERT: "!namespaceUri.isEmpty()" in file xml/qxmlstream.cpp, line 3711

      To reproduce: just input the following to the XML Stream Lint Example

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <tag xmlns="" />
      

       

      Also the W3C example (from the page cited above) fails:

      <?xml version='1.0'?>
      <Beers>
        <!-- the default namespace inside tables is that of HTML -->
        <table xmlns='http://www.w3.org/1999/xhtml'>
         <th><td>Name</td><td>Origin</td><td>Description</td></th>
         <tr> 
           <!-- no default namespace inside table cells -->
           <td><brandName xmlns="">Huntsman</brandName></td>
           <td><origin xmlns="">Bath, UK</origin></td>
           <td>
             <details xmlns=""><class>Bitter</class><hop>Fuggles</hop>
               <pro>Wonderful hop, light alcohol, good summer beer</pro>
               <con>Fragile; excessive variance pub to pub</con>
               </details>
              </td>
            </tr>
          </table>
        </Beers>
      

      Both examples are attached.

      Please note that this is not a corner case: many real-life xml documents use empty namespaces (including many OpenXML Office documents).

      Attachments

        Activity

          People

            thiago Thiago Macieira
            narcolessico Eugenio Rustico
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: