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

Provide a version of QXmlStreamWriter::writeEndElement that allows closing only specific tags or provides visibility into which tag has been closed.

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • None
    • None

    Description

      This proposal was suggested by external contributor Thibaut Cuvelier and reported by me on his behalf.

      QXmlStreamWriter provides a simple api to open and close elements with the `writeStartElement` and 'writeEndElement` pair.

      For the user of the API, this allows an easy way to write sequential code that ensures that tags are closed, but there is no visibility into what is being closed.
      In more involved codebases, where the "currently opened element" might not necessarily be easy to reason about, this might provide for slightly unsafe code.

      Indeed, this has proven to be the basis of various bugs during external contributions to QDoc.

      It is possible to externally keep track of what the currently opened element is, for example by "duplicating" the working of the internal stack of the QXmlStreamWriter instance in the code that uses it.

      Nonetheless, it could be useful to provide a first-party support for a safer flow.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            diseraluca Luca Di Sera
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes