本页内容

QDomDocumentType Class

QDomDocumentType 类是文档树中 DTD 的表示形式。更多内容...

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

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

公共函数

QDomDocumentType()
QDomDocumentType(const QDomDocumentType &documentType)
QDomNamedNodeMap entities() const
QString internalSubset() const
QString name() const
QDomNode::NodeType nodeType() const
QDomNamedNodeMap notations() const
QString publicId() const
QString systemId() const
QDomDocumentType &operator=(const QDomDocumentType &other)

详细说明

QDomDocumentType 类允许对 DTD 中的某些数据结构进行只读访问:它可以返回所有entities() 和notations() 的映射。 此外,函数name() 返回 &lt;!DOCTYPE name&gt; 标签中指定的文档类型名称。该类还提供了publicId()、systemId() 和internalSubset() 函数。

另请参阅 QDomDocument 。

成员函数文档

QDomDocumentType::QDomDocumentType()

创建一个空的 QDomDocumentType 对象。

QDomDocumentType::QDomDocumentType(const QDomDocumentType &documentType)

创建documentType 的副本。

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

QDomNamedNodeMap QDomDocumentType::entities() const

返回一个包含DTD中描述的所有实体的映射。

QString QDomDocumentType::internalSubset() const

返回文档类型的内部子集;如果不存在内部子集,则返回空字符串。

另请参阅 publicId() 和systemId()。

QString QDomDocumentType::name() const

返回 &lt;!DOCTYPE name&gt; 标签中指定的文档类型名称。

另请参阅 nodeName()。

QDomNode::NodeType QDomDocumentType::nodeType() const

返回DocumentTypeNode 。

另请参阅 isDocumentType() 和QDomNode::toDocumentType()。

QDomNamedNodeMap QDomDocumentType::notations() const

返回一个包含 DTD 中描述的所有标记的映射。

QString QDomDocumentType::publicId() const

返回外部 DTD 子集的公共标识符;如果没有公共标识符,则返回空字符串。

另请参阅 systemId()、internalSubset() 和QDomImplementation::createDocumentType()。

QString QDomDocumentType::systemId() const

返回外部 DTD 子集的系统标识符;若无系统标识符,则返回空字符串。

另请参阅 publicId()、internalSubset() 和QDomImplementation::createDocumentType()。

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

将other 分配给此文档类型。

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