Obsolete Members for QDomDocument
The following members of class
QDomDocument
are deprecated.
They are provided to keep old source code working. We strongly advise against using them in new code.
Public Functions
bool
setContent
(const QByteArray &
data
, bool
namespaceProcessing
, QString *
errorMsg
= nullptr, int *
errorLine
= nullptr, int *
errorColumn
= nullptr)
bool
setContent
(const QString &
text
, bool
namespaceProcessing
, QString *
errorMsg
= nullptr, int *
errorLine
= nullptr, int *
errorColumn
= nullptr)
bool
setContent
(QIODevice *
dev
, bool
namespaceProcessing
, QString *
errorMsg
= nullptr, int *
errorLine
= nullptr, int *
errorColumn
= nullptr)
bool
setContent
(const QByteArray &
buffer
, QString *
errorMsg
, int *
errorLine
= nullptr, int *
errorColumn
= nullptr)
bool
setContent
(const QString &
text
, QString *
errorMsg
, int *
errorLine
= nullptr, int *
errorColumn
= nullptr)
bool
setContent
(QIODevice *
dev
, QString *
errorMsg
, int *
errorLine
= nullptr, int *
errorColumn
= nullptr)
bool
setContent
(QXmlStreamReader *
reader
, bool
namespaceProcessing
, QString *
errorMsg
= nullptr, int *
errorLine
= nullptr, int *
errorColumn
= nullptr)
Member Function Documentation
bool
QDomDocument::
setContent
(const
QByteArray
&
data
,
bool
namespaceProcessing
,
QString
*
errorMsg
= nullptr,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
This function is deprecated since 6.8. We strongly advise against using it in new code.
Use the overload taking
ParseOptions
instead.
This is an overloaded function.
This function parses the XML document from the byte array
data
and sets it as the content of the document. It tries to detect the encoding of the document as required by the XML specification.
If
namespaceProcessing
is true, the parser recognizes namespaces in the XML file and sets the prefix name, local name and namespace URI to appropriate values. If
namespaceProcessing
is false, the parser does no namespace processing when it reads the XML file.
If a parse error occurs, this function returns
false
and the error message is placed in
*
errorMsg
, the line number in
*
errorLine
and the column number in
*
errorColumn
(unless the associated pointer is set to
nullptr
); otherwise this function returns
true
.
If
namespaceProcessing
is true, the function
QDomNode::prefix
() returns a string for all elements and attributes. It returns an empty string if the element or attribute has no prefix.
Text nodes consisting only of whitespace are stripped and won't appear in the
QDomDocument
.
If
namespaceProcessing
is false, the functions
QDomNode::prefix
(),
QDomNode::localName
() and
QDomNode::namespaceURI
() return an empty string.
Entity references are handled as follows:
References to internal general entities and character entities occurring in the content are included. The result is a
QDomText
node with the references replaced by their corresponding entity values.
References to parameter entities occurring in the internal subset are included. The result is a
QDomDocumentType
node which contains entity and notation declarations with the references replaced by their corresponding entity values.
Any general parsed entity reference which is not defined in the internal subset and which occurs in the content is represented as a
QDomEntityReference
node.
Any parsed entity reference which is not defined in the internal subset and which occurs outside of the content is replaced with an empty string.
Any unparsed entity reference is replaced with an empty string.
See also
QDomNode::namespaceURI
(),
QDomNode::localName
(),
QDomNode::prefix
(),
QString::isNull
(), and
QString::isEmpty
().
bool
QDomDocument::
setContent
(const
QString
&
text
,
bool
namespaceProcessing
,
QString
*
errorMsg
= nullptr,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
This function is deprecated since 6.8. We strongly advise against using it in new code.
This is an overloaded function.
Use the overloads taking
ParseOptions
instead.
This function reads the XML document from the string
text
, returning true if the content was successfully parsed; otherwise returns
false
. Since
text
is already a Unicode string, no encoding detection is done.
bool
QDomDocument::
setContent
(
QIODevice
*
dev
,
bool
namespaceProcessing
,
QString
*
errorMsg
= nullptr,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
This function is deprecated since 6.8. We strongly advise against using it in new code.
This is an overloaded function.
Use the overload taking
ParseOptions
instead.
This function reads the XML document from the IO device
dev
, returning true if the content was successfully parsed; otherwise returns
false
.
Note:
This method will try to open
dev
in read-only mode if it is not already open. In that case, the caller is responsible for calling close. This will change in Qt 7, which will no longer open
dev
. Applications should therefore open the device themselves before calling setContent.
bool
QDomDocument::
setContent
(const
QByteArray
&
buffer
,
QString
*
errorMsg
,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
This function is deprecated since 6.8. We strongly advise against using it in new code.
This is an overloaded function.
Use the overload returning
ParseResult
instead.
This function reads the XML document from the byte array
buffer
, returning true if the content was successfully parsed; otherwise returns false.
No namespace processing is performed.
bool
QDomDocument::
setContent
(const
QString
&
text
,
QString
*
errorMsg
,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
This function is deprecated since 6.8. We strongly advise against using it in new code.
This is an overloaded function.
Use the overload returning
ParseResult
instead.
This function reads the XML document from the string
text
, returning true if the content was successfully parsed; otherwise returns
false
. Since
text
is already a Unicode string, no encoding detection is performed.
No namespace processing is performed either.
bool
QDomDocument::
setContent
(
QIODevice
*
dev
,
QString
*
errorMsg
,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
This function is deprecated since 6.8. We strongly advise against using it in new code.
This is an overloaded function.
Use the overload returning
ParseResult
instead.
This function reads the XML document from the IO device
dev
, returning true if the content was successfully parsed; otherwise returns
false
.
No namespace processing is performed.
bool
QDomDocument::
setContent
(
QXmlStreamReader
*
reader
,
bool
namespaceProcessing
,
QString
*
errorMsg
= nullptr,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
This function is deprecated since 6.8. We strongly advise against using it in new code.
This is an overloaded function.
Use the overload taking
ParseOptions
instead.
This function reads the XML document from the
QXmlStreamReader
reader
and parses it. Returns
true
if the content was successfully parsed; otherwise returns
false
.
If
namespaceProcessing
is
true
, the parser recognizes namespaces in the XML file and sets the prefix name, local name and namespace URI to appropriate values. If
namespaceProcessing
is
false
, the parser does no namespace processing when it reads the XML file.
If a parse error occurs, the error message is placed in
*
errorMsg
, the line number in
*
errorLine
and the column number in
*
errorColumn
(unless the associated pointer is set to
nullptr
).
See also
QXmlStreamReader
.
©
2024
The Qt Company Ltd.