QAbstractXmlNodeModel Class Reference |
Constant | Value | Description |
---|---|---|
QAbstractXmlNodeModel::Parent | 0 | The parent of the context node |
QAbstractXmlNodeModel::FirstChild | 1 | The first child of the context node |
QAbstractXmlNodeModel::PreviousSibling | 2 | The previous child of the context node |
QAbstractXmlNodeModel::NextSibling | 3 | The next child of the context node |
Default constructor.
Destructor.
Returns the attributes of element. The caller guarantees that element is an element in this node model.
Returns the base URI for the node whose index is n. The caller guarantees that n is not null and that it belongs to a node in this node model.
The base URI of a node can be extracted using the fn:base-uri() function. The base URI is typically used for resolving relative URIs that appear in the node or its children. It is conformant to just return the document URI, although that might not properly reflect the underlying data.
This function maps to the dm:base-uri accessor, which returns a base URI according to the following:
The implementation guarantees to return a valid QUrl, or a default constructed QUrl. If a node has no base URI, as in the case where a comment has no parent, a default constructed QUrl is returned.
See also XQuery 1.0 and XPath 2.0 Data Model (XDM), 5.2 base-uri Accessor.
This function returns the relative document order for the nodes indexed by ni1 and ni2. It is used for the Is operator and for sorting nodes in document order.
The caller guarantees that ni1 and ni2 are not null and that both identify nodes in this node model.
If ni1 is identical to ni2, QXmlNodeModelIndex::Is is returned. If ni1 precedes ni2 in document order, QXmlNodeModelIndex::Precedes is returned. If ni1 follows ni2 in document order, QXmlNodeModelIndex::Follows is returned.
See also XQuery 1.0 and XPath 2.0 Data Model (XDM), 2.4 Document Order.
Creates a node index with data as its internal data. data is not constrained.
This is an overloaded member function, provided for convenience.
Creates a node index with pointer and additionalData as its internal data.
What pointer and additionalData is, is not constrained.
This is an overloaded member function, provided for convenience.
Creates a QXmlNodeModelIndex containing data and additionalData.
Returns the document URI of n. The document URI identifies the resource which is the document. For example, the document could be a regular file, e.g., file:/, or it could be the http:// URL of the location of a file. The document URI is used for resolving URIs and to simply know where the document is.
If the node model maps to a URI in a natural way, return that URI. Otherwise, return the company or product URI. The document URI can be any URI as long as its valid and absolute.
The caller guarantees that n is not null and that it belongs to this QAbstractXmlNodeModel.
This function maps to the dm:document-uri accessor, which returns a document URI according to the following:
See also XQuery 1.0 and XPath 2.0 Data Model (XDM), 5.4 document-uri Accessor, QUrl::isValid(), and QUrl::isRelative().
Returns the index of the element identified as id. XQuery's id() function calls this function.
The node index returned will be the element node whose value is of type ID and equals id, or it will be the element node that has an attribute whose typed value is of type ID and equals id. If there is no such element, a default constructed QXmlNodeModelIndex instance is returned. The implementor guarantees that if the returned node index is not null, it identifies an element.
It is not sufficient for an attribute or element to merely be called id. Its value type must also be ID. However, the reserved name xml:id is sufficient.
In id, the namespace URI and the prefix are undefined, and the local name is the ID that should be looked up.
See also XQuery 1.0 and XPath 2.0 Functions and Operators, 15.5.2 fn:id.
Returns a value indicating the kind of node identified by ni. The caller guarantees that ni is not null and that it identifies a node in this node model. This function maps to the dm:node-kind() accessor.
See also XQuery 1.0 and XPath 2.0 Data Model (XDM), 5.10 node-kind Accessor.
Returns the name of ni. The caller guarantees that ni is not null and that it belongs to this QAbstractXmlNodeModel.
If a node does not have a name, e.g., comment nodes, a null QXmlName is returned. QXmlNames must be created with the instance of QXmlQuery that is being used for evaluating queries using this QAbstractXmlNodeModel.
This function maps to the dm:node-name() accessor.
If ni is a processing instruction, a QXmlName is returned with the local name as the target name and the namespace URI and prefix both empty.
See also XQuery 1.0 and XPath 2.0 Data Model (XDM), 5.11 node-name Accessor and QXmlName.
Returns the in-scope namespaces of n. The caller guarantees that n is not null and that it belongs to this QAbstractXmlNodeModel.
This function corresponds to the dm:namespace-nodes accessor.
The returned vector of namespace declarations includes namespaces of the ancestors of n.
The caller guarantees that n is an Element that belongs to this QAbstractXmlNodeModel.
When QtXmlPatterns evaluate path expressions, it emulate them through a combination of calls with QSimpleXmlNodeModel::SimpleAxis values. Therefore, the implementation of this function must return the node, if any, that appears on the axis emanating from the origin.
If no such node is available, a default constructed QXmlNodeModelIndex is returned.
QSimpleXmlNodeModel eliminates the need to handle redundant corner cases by guaranteeing that it will never ask for:
A typical implementation performs a switch on the value of axis:
QXmlNodeModelIndex MyTreeModel::nextFromSimpleAxis(SimpleAxis axis, const QXmlNodeModelIndex &origin) const { // Convert the QXmlNodeModelIndex to a value that is specific to what we represent. const MyValue value = toMyValue(ni); switch(axis) { case Parent: return toNodeIndex(value.parent()); case FirstChild: case PreviousSibling: case NextSibling: // and so on } }
Returns the elements and/or attributes that have an IDREF value equal to idref. XQuery's idref() function calls this function.
The implementor guarantees that the nodes identified by the returned indexes are elements or attributes.
It is not sufficient for an attribute or element to merely be called idref. It must also be of type IDREF. Elements must be typed as xs:IDREF or xs:IDREFS, or, in the case of attributes, as IDREF or IDREFS in the schema.
In idref, the namespace URI and the prefix are undefined, and the local name is the ID that should be looked up.
See also XQuery 1.0 and XPath 2.0 Functions and Operators, 15.5.3 fn:idref.
Returns the root node of the tree that contains the node whose index is n. The caller guarantees that n is not null and that it identifies a node in this node model.
If n identifies a node that is a direct child of the root, parent() would return the same QXmlNodeModelIndex returned by this function.
Returns the string value for node n.
The caller guarantees that n is not null and that it belong to this QAbstractXmlNodeModel instance.
This function maps to the dm:string-value() accessor, which the specification completely specifies. Here's a summary:
See also XQuery 1.0 and XPath 2.0 Data Model (XDM), 5.13 string-value Accessor.
Returns the typed value for node node.
The typed value is an atomic value, which an element or attribute contains.
The caller guarantees that node is either an element or an attribute. The implementor guarantees that the returned QVariant has a value which is supported in XQuery. It cannot be an arbitrary QVariant value. The implementor also guarantees that stringValue() returns a lexical representation of typedValue()(this is guaranteed by QSimpleXmlNodeModel::stringValue()).
If the return QVariant is a default constructed variant, it signals that node has no typed value.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.4 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com