内容表

上一话题

QXmlFormatter

下一话题

QXmlName

QXmlItem

QXmlItem class contains either an XML node or an atomic value. 更多

Inheritance diagram of PySide2.QtXmlPatterns.QXmlItem

详细描述

XQuery , all expressions evaluate to a sequence of items, where each item is either an XML node or an atomic value. The query in the following snippet evaluates to sequence of five items.

<Code snippet "/tmp/snapshot-qt5full-5.15.0/qt5/qtbase/patternist/items.xq" not found>
											

The five items are: An element, an atomic value (binary data encoded in base64), a date, a float, and an attribute.

QXmlItem is the class that represents these XQuery items in the Qt XML Patterns API. A non-null instance of QXmlItem is either a node or an atomic value. Calling isNode() or isAtomicValue() tells you which it is. Atomic values are represented elsewhere in the Qt API as instances of QVariant , and an instance of QXmlItem that represents an atomic value can be converted to a QVariant 通过调用 toAtomicValue() . A QXmlItem that wraps a node is represented elsewhere as an instance of QXmlNodeModelIndex . A node QXmlItem can be converted to a QXmlNodeModelIndex 通过调用 toNodeModelIndex() .

A default constructed QXmlItem instance is neither a node nor an atomic value. It is considered null, in which case isNull() returns true.

An instance of QXmlItem will be left dangling if the XML node model it refers to is deleted, if it is a QXmlNodeModelIndex .

class QXmlItem

QXmlItem(atomicValue)

QXmlItem(other)

QXmlItem(node)

param node

QXmlNodeModelIndex

param other

QXmlItem

param atomicValue

object

Constructs a null QXmlItem that is neither a node nor an atomic value. isNull() returns true for a default constructed instance.

PySide2.QtXmlPatterns.QXmlItem. isAtomicValue ( )
返回类型

bool

Returns true if this item is an atomic value. Returns false if it is a node or null.

PySide2.QtXmlPatterns.QXmlItem. isNode ( )
返回类型

bool

Returns true if this item is a Node. Returns false if it is an atomic value or null.

PySide2.QtXmlPatterns.QXmlItem. isNull ( )
返回类型

bool

返回 true,若此 QXmlItem is neither a node nor an atomic value. Default constructed instances of QXmlItem are null.

PySide2.QtXmlPatterns.QXmlItem. toAtomicValue ( )
返回类型

object

若此 QXmlItem represents an atomic value, it is converted to an appropriate QVariant and returned. If this QXmlItem is not an atomic value, the return value is a default constructed QVariant . You can call isAtomicValue() to test whether the item is an atomic value.

另请参阅

isAtomicValue()

PySide2.QtXmlPatterns.QXmlItem. toNodeModelIndex ( )
返回类型

QXmlNodeModelIndex

若此 QXmlItem represents a node, it returns the item as a QXmlNodeModelIndex . If this QXmlItem is not a node, the return value is undefined. You can call isNode() to test whether the item is a node.

另请参阅

isNode()