以下成员源于类 QDomDocument 被弃用。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。
(deprecated in 6.8)
bool
|
setContent (QIODevice * dev , QString * errorMsg , int * errorLine = nullptr, int * errorColumn = nullptr) |
(deprecated in 6.8)
bool
|
setContent (const QByteArray & buffer , QString * errorMsg , int * errorLine = nullptr, int * errorColumn = nullptr) |
(deprecated in 6.8)
bool
|
setContent (const QString & text , QString * errorMsg , int * errorLine = nullptr, int * errorColumn = nullptr) |
(deprecated in 6.8)
bool
|
setContent (QIODevice * dev , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr) |
(deprecated in 6.8)
bool
|
setContent (QXmlStreamReader * reader , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr) |
(deprecated in 6.8)
bool
|
setContent (const QByteArray & data , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr) |
(deprecated in 6.8)
bool
|
setContent (const QString & text , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr) |
[deprecated in 6.8]
bool
QDomDocument::
setContent
(
QIODevice
*
dev
,
QString
*
errorMsg
,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
此函数从 6.8 起弃用。强烈建议在新代码中不要使用它。
这是重载函数。
Use the overload returning ParseResult 代替。
此函数读取 XML 文档从 IO 设备
dev
,返回 true 若内容被成功剖析;否则返回
false
.
不履行名称空间处理。
[deprecated in 6.8]
bool
QDomDocument::
setContent
(const
QByteArray
&
buffer
,
QString
*
errorMsg
,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
此函数从 6.8 起弃用。强烈建议在新代码中不要使用它。
这是重载函数。
Use the overload returning ParseResult 代替。
此函数读取 XML 文档从字节数组 buffer ,返回 true 若内容被成功剖析;否则返回 false。
不履行名称空间处理。
[deprecated in 6.8]
bool
QDomDocument::
setContent
(const
QString
&
text
,
QString
*
errorMsg
,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
此函数从 6.8 起弃用。强烈建议在新代码中不要使用它。
这是重载函数。
Use the overload returning ParseResult 代替。
此函数读取 XML 文档从字符串
text
,返回 true 若内容被成功剖析;否则返回
false
。由于
text
已经是 Unicode 字符串,不用履行编码检测。
也不履行名称空间处理。
[deprecated in 6.8]
bool
QDomDocument::
setContent
(
QIODevice
*
dev
,
bool
namespaceProcessing
,
QString
*
errorMsg
= nullptr,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
此函数从 6.8 起弃用。强烈建议在新代码中不要使用它。
这是重载函数。
Use the overload taking ParseOptions 代替。
此函数读取 XML 文档从 IO 设备
dev
,返回 true 若内容被成功剖析;否则返回
false
.
注意: 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.
[deprecated in 6.8]
bool
QDomDocument::
setContent
(
QXmlStreamReader
*
reader
,
bool
namespaceProcessing
,
QString
*
errorMsg
= nullptr,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
此函数从 6.8 起弃用。强烈建议在新代码中不要使用它。
这是重载函数。
Use the overload taking ParseOptions 代替。
此函数读取 XML 文档从
QXmlStreamReader
reader
并剖析它。返回
true
若内容被成功解析;否则返回
false
.
若
namespaceProcessing
is
true
,剖析器识别 XML 文件中的名称空间并将前缀名称、本地名称和名称空间 URI 设为适当值。若
namespaceProcessing
is
false
,剖析器不处理名称空间当它读取 XML 文件时。
若出现剖析错误,错误消息放置在
*
errorMsg
,行号在
*
errorLine
和列号在
*
errorColumn
(unless the associated pointer is set to
nullptr
).
另请参阅 QXmlStreamReader .
[deprecated in 6.8]
bool
QDomDocument::
setContent
(const
QByteArray
&
data
,
bool
namespaceProcessing
,
QString
*
errorMsg
= nullptr,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
此函数从 6.8 起弃用。强烈建议在新代码中不要使用它。
Use the overload taking ParseOptions 代替。
这是重载函数。
此函数剖析 XML 文档从字节数组 data 并将它设为文档内容。它试着按 XML 规范要求检测文档编码。
若 namespaceProcessing 为 true,剖析器识别 XML 文件中的名称空间并将前缀名称、本地名称和名称空间 URI 设为适当值。若 namespaceProcessing 为 false,剖析器不处理名称空间当它读取 XML 文件时。
若出现剖析错误,此函数返回
false
且错误消息放置于
*
errorMsg
,行号在
*
errorLine
和列号在
*
errorColumn
(unless the associated pointer is set to
nullptr
); otherwise this function returns
true
.
若 namespaceProcessing 为 true,函数 QDomNode::prefix () 返回所有元素和属性的字符串。它返回空字符串,若元素或属性没有前缀。
仅剥离由空白组成的文本节点,且不会出现在 QDomDocument .
若 namespaceProcessing 为 false,函数 QDomNode::prefix (), QDomNode::localName () 和 QDomNode::namespaceURI () 返回空字符串。
实体引用处理如下:
另请参阅 QDomNode::namespaceURI (), QDomNode::localName (), QDomNode::prefix (), QString::isNull (),和 QString::isEmpty ().
[deprecated in 6.8]
bool
QDomDocument::
setContent
(const
QString
&
text
,
bool
namespaceProcessing
,
QString
*
errorMsg
= nullptr,
int
*
errorLine
= nullptr,
int
*
errorColumn
= nullptr)
此函数从 6.8 起弃用。强烈建议在新代码中不要使用它。
这是重载函数。
Use the overloads taking ParseOptions 代替。
此函数读取 XML 文档从字符串
text
,返回 true 若内容被成功剖析;否则返回
false
。由于
text
已经是 Unicode 字符串,不用做编码检测。