QDomText Class
QDomText 类表示解析 XML 文档中的文本数据。更多
头文件: | #include <QDomText> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Xml) target_link_libraries(mytarget PRIVATE Qt6::Xml) |
qmake: | QT += xml |
继承: | QDomCharacterData |
继承于: |
- 所有成员的列表,包括继承成员
- QDomText 属于XML 类。
注意:该类中的所有函数都是可重入的。
公共函数
QDomText() | |
QDomText(const QDomText &text) | |
QDomNode::NodeType | nodeType() const |
QDomText | splitText(int offset) |
QDomText & | operator=(const QDomText &other) |
详细说明
您可以使用splitText() 将一个 QDomText 对象中的文本分割为两个 QDomText 对象。
有关文档对象模型的更多信息,请参阅第 1 级和第 2 级核心。有关 DOM 实现的一般介绍,请参阅QDomDocument 文档。
成员函数文档
QDomText::QDomText()
构造一个空的 QDomText 对象。
要构造一个有内容的 QDomText,请使用QDomDocument::createTextNode() 。
QDomText::QDomText(const QDomText &text)
构造text 的副本。
副本的数据是共享的(浅层副本):修改一个节点也会改变另一个节点。如果要进行深度复制,请使用cloneNode() 。
QDomNode::NodeType QDomText::nodeType() const
返回TextNode
。
QDomText QDomText::splitText(int offset)
将此 DOM 文本对象分割为两个QDomText 对象。该对象保留其第一个offset 字符,而第二个(新创建的)对象则带着剩余的字符插入到该对象之后的文档树中。
函数将返回新创建的对象。
另请参见 QDomNode::normalize()。
QDomText &QDomText::operator=(const QDomText &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.