QXmlStreamReader: Add key/value to "Invalid attribute" error message

When QXmlReaderPrivate::startDocument() parses declarations, it reports
an error if a declaration contains an unknown attribute. The message
doesn't mention the invalid attribute's key and value, so the user has
to guess which one is the faulty declaration.

This patch extends the error message by adding the respective key/value
pair.

Change-Id: I7f5a228bed44937472880c3b3d63d5e816b39361
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 27906b7da84c22b244b612a557f57606d8d4d626)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Axel Spoerl 2023-05-30 09:01:24 +02:00 committed by Qt Cherry-pick Bot
parent c66cad7ccf
commit 6f8c0a09ad

View File

@ -1812,7 +1812,7 @@ void QXmlStreamReaderPrivate::startDocument()
else
err = QXmlStream::tr("Standalone accepts only yes or no.");
} else {
err = QXmlStream::tr("Invalid attribute in XML declaration.");
err = QXmlStream::tr("Invalid attribute in XML declaration: %1 = %2").arg(key).arg(value);
}
}