QDomProcessingInstruction 类表示 XML (可扩展标记语言) 处理指令。 更多...
| 头: |
#include <QDomProcessingInstruction>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Xml)
target_link_libraries(mytarget PRIVATE Qt6::Xml)
|
| qmake: |
QT += xml
|
| 继承: | QDomNode |
注意: 此类的所有函数 可重入 .
| QDomProcessingInstruction () | |
| QDomProcessingInstruction (const QDomProcessingInstruction & processingInstruction ) | |
| QString | data () const |
| QDomNode::NodeType | nodeType () const |
| void | setData (const QString & data ) |
| QString | target () const |
| QDomProcessingInstruction & | operator= (const QDomProcessingInstruction & other ) |
用于 XML 的处理指令将特定处理器信息保持在文档文本中。
出现在 XML 文档顶部的 XML 声明,通常为
<?xml version='1.0' encoding='UTF-8'?>
,QDom 将其视为处理指令。这很不幸,因为 XML 声明不是处理指令;除其它差异外,不可以将其插入文档任何地方,但可插入第一行。
注意: Do not use this function to create an XML declaration. Although the XML declaration shares the same syntax as a processing instruction, it is not one. According to the XML 1.0 Specification 和 W3C DOM Structure Model , the XML declaration is part of the document prolog and not part of the DOM tree - meaning it should not be represented as a DOM node and cannot be created or inserted via the DOM API. If you need to generate a well-formed XML document that includes an XML declaration, use QXmlStreamWriter , which provides proper support for writing the declaration through writeStartDocument .
处理指令内容的检索采用 data () 和设置采用 setData ()。处理指令目标的检索采用 target ().
有关文档对象模型的进一步信息,见 级别 1 and 级别 2 核心 。有关 DOM 实现的更一般介绍,见 QDomDocument 文档编制。
构造空处理指令。使用 QDomDocument::createProcessingInstruction () 以创建带有内容的处理指令。
构造副本为 processingInstruction .
拷贝数据是共享的 (浅拷贝):修改一节点也会改变另一节点。若想要做深拷贝,使用 cloneNode ().
返回此处理指令的内容。
返回
ProcessingInstructionNode
.
将处理指令中包含的数据设为 data .
另请参阅 data ().
返回此处理指令的目标。
另请参阅 data ().
赋值 other 到此处理指令。
拷贝数据是共享的 (浅拷贝):修改一节点也会改变另一节点。若想要做深拷贝,使用 cloneNode ().