diff options
-rw-r--r-- | src/corelib/serialization/qxmlstream.cpp | 17 | ||||
-rw-r--r-- | src/corelib/serialization/qxmlstream.h | 1 | ||||
-rw-r--r-- | src/corelib/serialization/qxmlstream_p.h | 2 | ||||
-rw-r--r-- | src/xml/dom/qdomhelpers.cpp | 3 |
4 files changed, 19 insertions, 4 deletions
diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp index 5f536d0571..21590135dd 100644 --- a/src/corelib/serialization/qxmlstream.cpp +++ b/src/corelib/serialization/qxmlstream.cpp @@ -2692,6 +2692,8 @@ bool QXmlStreamReader::isCDATA() const XML declaration; otherwise returns \c false. If no XML declaration has been parsed, this function returns \c false. + + \sa hasStandaloneDeclaration() */ bool QXmlStreamReader::isStandaloneDocument() const { @@ -2699,6 +2701,21 @@ bool QXmlStreamReader::isStandaloneDocument() const return d->standalone; } +/*! + \since 6.6 + + Returns \c true if this document has an explicit standalone + declaration (can be 'yes' or 'no'); otherwise returns \c false; + + If no XML declaration has been parsed, this function returns \c false. + + \sa isStandaloneDocument() + */ +bool QXmlStreamReader::hasStandaloneDeclaration() const +{ + Q_D(const QXmlStreamReader); + return d->hasStandalone; +} /*! \since 4.4 diff --git a/src/corelib/serialization/qxmlstream.h b/src/corelib/serialization/qxmlstream.h index 230a45f683..fc0742debc 100644 --- a/src/corelib/serialization/qxmlstream.h +++ b/src/corelib/serialization/qxmlstream.h @@ -246,6 +246,7 @@ public: inline bool isProcessingInstruction() const { return tokenType() == ProcessingInstruction; } bool isStandaloneDocument() const; + bool hasStandaloneDeclaration() const; QStringView documentVersion() const; QStringView documentEncoding() const; diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h index ffa49f8c64..b6e54aad89 100644 --- a/src/corelib/serialization/qxmlstream_p.h +++ b/src/corelib/serialization/qxmlstream_p.h @@ -510,8 +510,6 @@ public: QXmlStreamEntityResolver *entityResolver; - static QXmlStreamReaderPrivate *get(QXmlStreamReader *q) { return q->d_func(); } - private: /*! \internal Never assign to variable type directly. Instead use this function. diff --git a/src/xml/dom/qdomhelpers.cpp b/src/xml/dom/qdomhelpers.cpp index 48869907f8..0649e0c75d 100644 --- a/src/xml/dom/qdomhelpers.cpp +++ b/src/xml/dom/qdomhelpers.cpp @@ -266,8 +266,7 @@ bool QDomParser::parseProlog() value += u" standalone='yes'"_s; } else { // Add the standalone attribute only if it was specified - QXmlStreamReaderPrivate *priv = QXmlStreamReaderPrivate::get(reader); - if (priv->hasStandalone) + if (reader->hasStandaloneDeclaration()) value += u" standalone='no'"_s; } |