QDomDocumentFragment Class

QDomDocumentFragment クラスは QDomNodes のツリーで、通常は完全なQDomDocument ではありません。さらに...

ヘッダー #include <QDomDocumentFragment>
CMake: find_package(Qt6 REQUIRED COMPONENTS Xml)
target_link_libraries(mytarget PRIVATE Qt6::Xml)
qmake: QT += xml
継承: QDomNode

注意:このクラスの関数はすべてリエントラントです。

パブリック関数

QDomDocumentFragment()
QDomDocumentFragment(const QDomDocumentFragment &documentFragment)
QDomNode::NodeType nodeType() const
QDomDocumentFragment &operator=(const QDomDocumentFragment &other)

詳細説明

複雑なツリー操作を行う場合、ノードとその関係を格納する軽量なクラスがあると便利です。QDomDocumentFragment は、必ずしも整形式の XML ドキュメントを表すとは限らないドキュメントのサブツリーを格納します。

QDomDocumentFragment は、いくつかのノードをリストでグループ化し、それらをまとめてあるノードの子として挿入したい場合にも便利です。このような場合、QDomDocumentFragment を子ノードのリストの一時的なコンテナとして使用することができます。

QDomDocumentFragment の最も重要な特徴は、QDomNode::insertAfter(),QDomNode::insertBefore(),QDomNode::replaceChild(),QDomNode::appendChild() によって特別な方法で扱われることです。フラグメント自身を挿入する代わりに、フラグメントのすべての子を挿入します。

メンバ関数のドキュメント

QDomDocumentFragment::QDomDocumentFragment()

空のドキュメントフラグメントを作成します。

QDomDocumentFragment::QDomDocumentFragment(const QDomDocumentFragment &documentFragment)

documentFragment のコピーを構築する。

コピーのデータは共有されます(シャローコピー):一方のノードを変更すると、もう一方のノードも変更されます。深いコピーを作成したい場合は、cloneNode() を使用します。

QDomNode::NodeType QDomDocumentFragment::nodeType() const

DocumentFragment を返す。

isDocumentFragment() およびQDomNode::toDocumentFragment()も参照のこと

QDomDocumentFragment &QDomDocumentFragment::operator=(const QDomDocumentFragment &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.