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.