本页内容

QDomCDATASection Class

QDomCDATASection 类表示一个 XML CDATA 片段。更多内容...

头文件: #include <QDomCDATASection>
CMake: find_package(Qt6 REQUIRED COMPONENTS Xml)
target_link_libraries(mytarget PRIVATE Qt6::Xml)
qmake: QT += xml
继承自: QDomText

注意:该类中的所有函数均为可重入函数。

公共函数

QDomCDATASection()
QDomCDATASection(const QDomCDATASection &cdataSection)
QDomNode::NodeType nodeType() const
QDomCDATASection &operator=(const QDomCDATASection &other)

详细说明

CDATA 部分用于转义包含某些字符的文本块,否则这些字符会被视为标记。CDATA 部分中唯一被识别的分隔符是“]]&gt;”字符串,该字符串用于结束 CDATA 部分。 CDATA 部分不能嵌套。其主要目的是包含 XML 片段等内容,而无需对所有分隔符进行转义。

QDomNode::normalize() 函数不会合并相邻的 QDomCDATASection 节点。

有关文档对象模型(DOM)的更多信息,请参阅http://www.w3.org/TR/REC-DOM-Level-1/和http://www.w3.org/TR/DOM-Level-2-Core/。有关 DOM 实现的更通用的介绍,请参阅QDomDocument 文档。

成员函数文档

QDomCDATASection::QDomCDATASection()

构建一个空的CDATA段。若要创建包含内容的CDATA段,请使用QDomDocument::createCDATASection()函数。

QDomCDATASection::QDomCDATASection(const QDomCDATASection &cdataSection)

创建cdataSection 的副本。

该副本的数据是共享的(浅拷贝):修改其中一个节点也会导致另一个节点发生变化。若要进行深拷贝,请使用cloneNode()。

QDomNode::NodeType QDomCDATASection::nodeType() const

返回CDATASection 。

QDomCDATASection &QDomCDATASection::operator=(const QDomCDATASection &other)

将other 赋值给此CDATA段。

该复制的数据是共享的(浅拷贝):修改其中一个节点也会改变另一个节点。若要进行深拷贝,请使用cloneNode()。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.