summaryrefslogtreecommitdiffstats
path: root/src/xml/dom/qdom.cpp
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2019-11-07 17:26:55 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2020-01-06 18:13:01 +0100
commit82d02b7b95908dec16e41c5af1c63579729c589b (patch)
tree6f78be54709ea918c63e265c61d236be88fbb1f0 /src/xml/dom/qdom.cpp
parent844ef184e8021237280a45ead04a3ab39cefa657 (diff)
Deprecate SAX classes in Qt XML
Deprecated the SAX classes and disabled or replaced their uses in tests if applicable. Removed the saxbookmarks example, no point in keeping examples for the deprecated code. [ChangeLog][QtXml] SAX classes are now deprecated. Use QXmlStreamReader, QXmlStreamWriter in QtCore instead. Task-number: QTBUG-76177 Change-Id: Ic171d62fa0527b0f36f94cf09a69586092269957 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/xml/dom/qdom.cpp')
-rw-r--r--src/xml/dom/qdom.cpp37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index cb753ed573..bbc877eead 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -5691,6 +5691,10 @@ void QDomDocumentPrivate::clear()
QDomNodePrivate::clear();
}
+#if QT_DEPRECATED_SINCE(5, 15)
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
static void initializeReader(QXmlSimpleReader &reader, bool namespaceProcessing)
{
reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), namespaceProcessing);
@@ -5734,6 +5738,9 @@ bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader
return true;
}
+QT_WARNING_POP
+
+#endif // QT_DEPRECATED_SINCE(5, 15)
bool QDomDocumentPrivate::setContent(QXmlStreamReader *reader, bool namespaceProcessing,
QString *errorMsg, int *errorLine, int *errorColumn)
@@ -6183,8 +6190,11 @@ bool QDomDocument::setContent(const QString& text, bool namespaceProcessing, QSt
if (!impl)
impl = new QDomDocumentPrivate();
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QXmlInputSource source;
+QT_WARNING_POP
source.setData(text);
return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);
#else
@@ -6252,10 +6262,13 @@ bool QDomDocument::setContent(const QByteArray &data, bool namespaceProcessing,
if (!impl)
impl = new QDomDocumentPrivate();
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15)
QBuffer buf;
buf.setData(data);
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QXmlInputSource source(&buf);
+QT_WARNING_POP
return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);
#else
QXmlStreamReader streamReader(data);
@@ -6275,8 +6288,11 @@ bool QDomDocument::setContent(QIODevice* dev, bool namespaceProcessing, QString
if (!impl)
impl = new QDomDocumentPrivate();
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QXmlInputSource source(dev);
+QT_WARNING_POP
return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);
#else
QXmlStreamReader streamReader(dev);
@@ -6285,14 +6301,18 @@ bool QDomDocument::setContent(QIODevice* dev, bool namespaceProcessing, QString
#endif
}
+#if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
+ \obsolete
\since 4.5
This function reads the XML document from the QXmlInputSource \a source,
returning true if the content was successfully parsed; otherwise returns \c false.
*/
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn )
{
if (!impl)
@@ -6301,6 +6321,9 @@ bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing,
initializeReader(reader, namespaceProcessing);
return IMPL->setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn);
}
+QT_WARNING_POP
+
+#endif
/*!
\overload
@@ -6333,6 +6356,7 @@ bool QDomDocument::setContent(const QByteArray& buffer, QString *errorMsg, int *
/*!
\overload
+ \obsolete
This function reads the XML document from the IO device \a dev, returning
true if the content was successfully parsed; otherwise returns \c false.
@@ -6344,8 +6368,10 @@ bool QDomDocument::setContent(QIODevice* dev, QString *errorMsg, int *errorLine,
return setContent(dev, false, errorMsg, errorLine, errorColumn);
}
+#if QT_DEPRECATED_SINCE(5, 15)
/*!
\overload
+ \obsolete
This function reads the XML document from the QXmlInputSource \a source and
parses it with the QXmlReader \a reader, returning true if the content was
@@ -6357,12 +6383,17 @@ bool QDomDocument::setContent(QIODevice* dev, QString *errorMsg, int *errorLine,
\sa QXmlSimpleReader
*/
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
bool QDomDocument::setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn )
{
if (!impl)
impl = new QDomDocumentPrivate();
return IMPL->setContent(source, reader, nullptr, errorMsg, errorLine, errorColumn);
}
+QT_WARNING_POP
+
+#endif
/*!
\overload