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 ().