本页内容

QDomEntity Class

QDomEntity 类表示一个 XML 实体。更多内容...

标题: #include <QDomEntity>
CMake: find_package(Qt6 REQUIRED COMPONENTS Xml)
target_link_libraries(mytarget PRIVATE Qt6::Xml)
qmake: QT += xml
继承自: QDomNode

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

公共函数

QDomEntity()
QDomEntity(const QDomEntity &entity)
QDomNode::NodeType nodeType() const
QString notationName() const
QString publicId() const
QString systemId() const
QDomEntity &operator=(const QDomEntity &other)

详细说明

该类表示 XML 文档中的实体,无论该文档是已解析的还是未解析的。请注意,该类对实体本身进行建模,而不是对实体声明进行建模。

DOM 不支持编辑实体节点;如果用户想要更改实体的内容,则必须在 DOM 树中将每个相关的QDomEntityReference 节点替换为该实体内容的克隆,然后对每个克隆进行所需的更改。实体节点的所有子节点均为只读。

实体节点没有父节点。

在可用时,您可以访问该实体的publicId()、systemId() 和notationName() 方法。

有关文档对象模型(DOM)的更多信息,请参阅第 1 级 和 第 2 级核心规范。有关 DOM 实现的更通用的介绍,请参阅QDomDocument 文档。

成员函数文档

QDomEntity::QDomEntity()

创建一个空实体。

QDomEntity::QDomEntity(const QDomEntity &entity)

创建entity 的副本。

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

QDomNode::NodeType QDomEntity::nodeType() const

返回EntityNode 。

QString QDomEntity::notationName() const

对于未解析的实体,该函数返回该实体的符号名称;对于已解析的实体,该函数返回一个空字符串。

QString QDomEntity::publicId() const

返回与该实体关联的公共标识符。如果未指定公共标识符,则返回空字符串。

QString QDomEntity::systemId() const

返回与该实体关联的系统标识符。如果未指定系统标识符,则返回空字符串。

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

将 `other ` 赋值给此 DOM 实体。

该复制的数据是共享的(浅拷贝):修改一个节点也会改变另一个节点。若要进行深拷贝,请使用 `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.