qt5base-lts/tests/auto/xml
Axel Spoerl 11f14c3b0d QDomDocument: no longer drop a provided 'standalone' attribute if 'no'
- Definition of 'standalone' attribute:
An XML declaration containing the attribute 'standalone' with its
value set to 'yes', tells the parser to ignore markup declarations
in the DTD and to use them only for validation.
The declaration attribute is optional and defaults to 'no'.

- Behavior Qt5
In qt5, DOM documents contained the standalone attribute,
regardless of whether or not it was explicitly specified.

- Behavior Qt6
In Qt6, the standalone attribute was only contained in a DOM document,
if its value was 'yes'. If it was explicitly declared with the value
being 'no', it was dropped in the DOM document.

- Expected behavior
If the source specified it overtly, then the generated XML should
contain the attribute, even when it takes its default value.

- Code base
QXmlStreamReader provides a public bool getter isStandaloneDocument().
This says whether the document is standalone or not.
The information whether the attribute was actually specified gets lost.
In consequence, the attribute was always dropped on non-standalone
documents.

- Fix
This patch makes hasStandalone a member of QXmlStreamReaderPrivate, to
record whether the attribute has been explicitly specified.

QDomParser is modified to retain the standalone attribute, if
QXmlStreamReaderPrivate::hasStandalone is true.

- Test
The patch adds a test function in tst_QDom.

Fixes: QTBUG-111200
Pick-to: 6.5 6.2
Change-Id: I06a0f230a2d69597dd6453f8fd3b036943d08735
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-04-24 21:49:29 +02:00
..
dom QDomDocument: no longer drop a provided 'standalone' attribute if 'no' 2023-04-24 21:49:29 +02:00
CMakeLists.txt Activate tst_qdom for Android 2022-02-22 17:22:58 +01:00