QDomComment Class

QDomComment 类表示 XML 注释。更多

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

注意:该类中的所有函数都是可重入的

公共函数

QDomComment()
QDomComment(const QDomComment &comment)
QDomNode::NodeType nodeType() const
QDomComment &operator=(const QDomComment &other)

详细描述

解析后的 XML 中的注释,如下面的注释:

<!-- this is a comment -->

的 QDomComment 对象在解析后的 Dom 树中表示。

有关文档对象模型的更多信息,请参阅第 1 级第 2 级核心。有关 DOM 实现的一般介绍,请参阅QDomDocument 文档。

成员函数文档

QDomComment::QDomComment()

构造一个空注释。要构建一个有内容的注释,请使用QDomDocument::createComment() 函数。

QDomComment::QDomComment(const QDomComment &comment)

构造comment 的副本。

副本的数据是共享的(浅层副本):修改一个节点也会改变另一个节点。如果要进行深度复制,请使用cloneNode() 。

QDomNode::NodeType QDomComment::nodeType() const

返回CommentNode

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

为该 DOM 注释指定other

副本的数据是共享的(浅层副本):修改一个节点也会改变另一个节点。如果要进行深度复制,请使用cloneNode()。

© 2025 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.