返回介绍

QDomDocumentFragment Class

发布于 2019-10-04 14:59:45 字数 2851 浏览 1109 评论 0 收藏 0

The QDomDocumentFragment class is a tree of QDomNodes which is not usually a complete QDomDocument. More...

#include <qdom.h>

Inherits QDomNode.

List of all member functions.

Public Members

  • QDomDocumentFragment ()
  • QDomDocumentFragment ( constQDomDocumentFragment&x )
  • QDomDocumentFragment & operator= ( constQDomDocumentFragment&x )
  • ~QDomDocumentFragment ()
  • virtual QDomNode::NodeType nodeType () const
  • virtual bool isDocumentFragment () const

Detailed Description

The QDomDocumentFragment class is a tree of QDomNodes which is not usually a complete QDomDocument.

If you want to do complex tree operations it is useful to have a lightweight class to store nodes and their relations. QDomDocumentFragment stores a subtree of a document which does not necessarily represent a well-formed XML document.

QDomDocumentFragment is also useful if you want to group several nodes in a list and insert them all together as children of some node. In these cases QDomDocumentFragment can be used as a temporary container for this list of children.

The most important feature of QDomDocumentFragment is that it is treated in a special way by QDomNode::insertAfter(), QDomNode::insertBefore() and QDomNode::replaceChild(): instead of inserting the fragment itself, all the fragment's children are inserted.

See also XML.


Member Function Documentation

QDomDocumentFragment::QDomDocumentFragment ()

Constructs an empty document fragment.

QDomDocumentFragment::QDomDocumentFragment ( constQDomDocumentFragment&x )

Constructs a copy of x.

The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode().

QDomDocumentFragment::~QDomDocumentFragment ()

Destroys the object and frees its resources.

bool QDomDocumentFragment::isDocumentFragment () const [virtual]

This function reimplements QDomNode::isDocumentFragment().

See also nodeType() and QDomNode::toDocumentFragment().

Reimplemented from QDomNode.

QDomNode::NodeType QDomDocumentFragment::nodeType () const [virtual]

Returns DocumentFragment.

See also isDocumentFragment() and QDomNode::toDocumentFragment().

Reimplemented from QDomNode.

QDomDocumentFragment& QDomDocumentFragment::operator= ( constQDomDocumentFragment&x )

Assigns x to this DOM document fragment.

The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode().

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文