QDomNode Class Reference |
Constant | Value | Description |
---|---|---|
QDomNode::ElementNode | 1 | |
QDomNode::AttributeNode | 2 | |
QDomNode::TextNode | 3 | |
QDomNode::CDATASectionNode | 4 | |
QDomNode::EntityReferenceNode | 5 | |
QDomNode::EntityNode | 6 | |
QDomNode::ProcessingInstructionNode | 7 | |
QDomNode::CommentNode | 8 | |
QDomNode::DocumentNode | 9 | |
QDomNode::DocumentTypeNode | 10 | |
QDomNode::DocumentFragmentNode | 11 | |
QDomNode::NotationNode | 12 | |
QDomNode::BaseNode | 21 | A QDomNode object, i.e. not a QDomNode subclass. |
QDomNode::CharacterDataNode | 22 |
Constructs a null node.
Constructs a copy of n.
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().
Destroys the object and frees its resources.
Appends newChild as the node's last child.
If newChild is the child of another node, it is reparented to this node. If newChild is a child of this node, then its position in the list of children is changed.
If newChild is a QDomDocumentFragment, then the children of the fragment are removed from the fragment and appended.
Returns a new reference to newChild.
See also insertBefore(), insertAfter(), replaceChild(), and removeChild().
Returns a named node map of all attributes. Attributes are only provided for QDomElements.
Changing the attributes in the map will also change the attributes of this QDomNode.
Returns a list of all direct child nodes.
Most often you will call this function on a QDomElement object.
For example, if the XML document looks like this:
<body> <h1>Heading</h1> <p>Hello <b>you</b></p> </body>
Then the list of child nodes for the "body"-element will contain the node created by the <h1> tag and the node created by the <p> tag.
The nodes in the list are not copied; so changing the nodes in the list will also change the children of this node.
See also firstChild() and lastChild().
Converts the node into a null node; if it was not a null node before, its type and contents are deleted.
See also isNull().
Creates a deep (not shallow) copy of the QDomNode.
If deep is true, then the cloning is done recursively which means that all the node's children are deep copied too. If deep is false only the node itself is copied and the copy will have no child nodes.
For nodes created by QDomDocument::setContent(), this function returns the column number in the XML document where the node was parsed. Otherwise, -1 is returned.
This function was introduced in Qt 4.1.
See also lineNumber() and QDomDocument::setContent().
Returns the first child of the node. If there is no child node, a null node is returned. Changing the returned node will also change the node in the document tree.
See also lastChild() and childNodes().
Returns the first child element with tag name tagName if tagName is non-empty; otherwise returns the first child element. Returns a null element if no such child exists.
See also lastChildElement(), previousSiblingElement(), and nextSiblingElement().
Returns true if the node has attributes; otherwise returns false.
See also attributes().
Returns true if the node has one or more children; otherwise returns false.
Inserts the node newChild after the child node refChild. refChild must be a direct child of this node. If refChild is null then newChild is appended as this node's last child.
If newChild is the child of another node, it is reparented to this node. If newChild is a child of this node, then its position in the list of children is changed.
If newChild is a QDomDocumentFragment, then the children of the fragment are removed from the fragment and inserted after refChild.
Returns a new reference to newChild on success or a null node on failure.
See also insertBefore(), replaceChild(), removeChild(), and appendChild().
Inserts the node newChild before the child node refChild. refChild must be a direct child of this node. If refChild is null then newChild is inserted as the node's first child.
If newChild is the child of another node, it is reparented to this node. If newChild is a child of this node, then its position in the list of children is changed.
If newChild is a QDomDocumentFragment, then the children of the fragment are removed from the fragment and inserted before refChild.
Returns a new reference to newChild on success or a null node on failure.
See also insertAfter(), replaceChild(), removeChild(), and appendChild().
Returns true if the node is an attribute; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomAttribute; you can get the QDomAttribute with toAttribute().
See also toAttr().
Returns true if the node is a CDATA section; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomCDATASection; you can get the QDomCDATASection with toCDATASection().
See also toCDATASection().
Returns true if the node is a character data node; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomCharacterData; you can get the QDomCharacterData with toCharacterData().
See also toCharacterData().
Returns true if the node is a comment; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomComment; you can get the QDomComment with toComment().
See also toComment().
Returns true if the node is a document; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomDocument; you can get the QDomDocument with toDocument().
See also toDocument().
Returns true if the node is a document fragment; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomDocumentFragment; you can get the QDomDocumentFragment with toDocumentFragment().
See also toDocumentFragment().
Returns true if the node is a document type; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomDocumentType; you can get the QDomDocumentType with toDocumentType().
See also toDocumentType().
Returns true if the node is an element; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomElement; you can get the QDomElement with toElement().
See also toElement().
Returns true if the node is an entity; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomEntity; you can get the QDomEntity with toEntity().
See also toEntity().
Returns true if the node is an entity reference; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomEntityReference; you can get the QDomEntityReference with toEntityReference().
See also toEntityReference().
Returns true if the node is a notation; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomNotation; you can get the QDomNotation with toNotation().
See also toNotation().
Returns true if this node is null (i.e. if it has no type or contents); otherwise returns false.
Returns true if the node is a processing instruction; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomProcessingInstruction; you can get the QProcessingInstruction with toProcessingInstruction().
See also toProcessingInstruction().
Returns true if the DOM implementation implements the feature feature and this feature is supported by this node in the version version; otherwise returns false.
See also QDomImplementation::hasFeature().
Returns true if the node is a text node; otherwise returns false.
If this function returns true, it does not imply that this object is a QDomText; you can get the QDomText with toText().
See also toText().
Returns the last child of the node. If there is no child node, a null node is returned. Changing the returned node will also change the node in the document tree.
See also firstChild() and childNodes().
Returns the last child element with tag name tagName if tagName is non-empty; otherwise returns the first child element. Returns a null element if no such child exists.
See also firstChildElement(), previousSiblingElement(), and nextSiblingElement().
For nodes created by QDomDocument::setContent(), this function returns the line number in the XML document where the node was parsed. Otherwise, -1 is returned.
This function was introduced in Qt 4.1.
See also columnNumber() and QDomDocument::setContent().
If the node uses namespaces, this function returns the local name of the node; otherwise it returns an empty string.
Only nodes of type ElementNode or AttributeNode can have namespaces. A namespace must have been specified at creation time; it is not possible to add a namespace afterwards.
QDomDocument::createAttributeNS()
See also prefix(), namespaceURI(), and QDomDocument::createElementNS().
Returns the first direct child node for which nodeName() equals name.
If no such direct child exists, a null node is returned.
See also nodeName().
Returns the namespace URI of this node or an empty string if the node has no namespace URI.
Only nodes of type ElementNode or AttributeNode can have namespaces. A namespace URI must be specified at creation time and cannot be changed later.
QDomDocument::createAttributeNS()
See also prefix(), localName(), and QDomDocument::createElementNS().
Returns the next sibling in the document tree. Changing the returned node will also change the node in the document tree.
If you have XML like this:
<h1>Heading</h1> <p>The text...</p> <h2>Next heading</h2>
and this QDomNode represents the <p> tag, nextSibling() will return the node representing the <h2> tag.
See also previousSibling().
Returns the next sibilng element with tag name tagName if tagName is non-empty; otherwise returns any next sibling element. Returns a null element if no such sibling exists.
See also firstChildElement(), previousSiblingElement(), and lastChildElement().
Returns the name of the node.
The meaning of the name depends on the subclass:
Name | Meaning |
---|---|
QDomAttr | The name of the attribute |
QDomCDATASection | The string "#cdata-section" |
QDomComment | The string "#comment" |
QDomDocument | The string "#document" |
QDomDocumentFragment | The string "#document-fragment" |
QDomDocumentType | The name of the document type |
QDomElement | The tag name |
QDomEntity | The name of the entity |
QDomEntityReference | The name of the referenced entity |
QDomNotation | The name of the notation |
QDomProcessingInstruction | The target of the processing instruction |
QDomText | The string "#text" |
See also nodeValue().
Returns the type of the node.
See also toAttr(), toCDATASection(), toDocumentFragment(), toDocument(), toDocumentType(), toElement(), toEntityReference(), toText(), toEntity(), toNotation(), toProcessingInstruction(), toCharacterData(), and toComment().
Returns the value of the node.
The meaning of the value depends on the subclass:
Name | Meaning |
---|---|
QDomAttr | The attribute value |
QDomCDATASection | The content of the CDATA section |
QDomComment | The comment |
QDomProcessingInstruction | The data of the processing intruction |
QDomText | The text |
All the other subclasses do not have a node value and will return an empty string.
See also setNodeValue() and nodeName().
Calling normalize() on an element converts all its children into a standard form. This means that adjacent QDomText objects will be merged into a single text object (QDomCDATASection nodes are not merged).
Returns the document to which this node belongs.
Returns the parent node. If this node has no parent, a null node is returned (i.e. a node for which isNull() returns true).
Returns the namespace prefix of the node or an empty string if the node has no namespace prefix.
Only nodes of type ElementNode or AttributeNode can have namespaces. A namespace prefix must be specified at creation time. If a node was created with a namespace prefix, you can change it later with setPrefix().
If you create an element or attribute with QDomDocument::createElement() or QDomDocument::createAttribute(), the prefix will be an empty string. If you use QDomDocument::createElementNS() or QDomDocument::createAttributeNS() instead, the prefix will not be an empty string; but it might be an empty string if the name does not have a prefix.
QDomDocument::createElementNS() QDomDocument::createAttributeNS()
See also setPrefix(), localName(), and namespaceURI().
Returns the previous sibling in the document tree. Changing the returned node will also change the node in the document tree.
For example, if you have XML like this:
<h1>Heading</h1> <p>The text...</p> <h2>Next heading</h2>
and this QDomNode represents the <p> tag, previousSibling() will return the node representing the <h1> tag.
See also nextSibling().
Returns the previous sibilng element with tag name tagName if tagName is non-empty; otherwise returns any previous sibling element. Returns a null element if no such sibling exists.
See also firstChildElement(), nextSiblingElement(), and lastChildElement().
Removes oldChild from the list of children. oldChild must be a direct child of this node.
Returns a new reference to oldChild on success or a null node on failure.
See also insertBefore(), insertAfter(), replaceChild(), and appendChild().
Replaces oldChild with newChild. oldChild must be a direct child of this node.
If newChild is the child of another node, it is reparented to this node. If newChild is a child of this node, then its position in the list of children is changed.
If newChild is a QDomDocumentFragment, then oldChild is replaced by all of the children of the fragment.
Returns a new reference to oldChild on success or a null node an failure.
See also insertBefore(), insertAfter(), removeChild(), and appendChild().
Writes the XML representation of the node and all its children to the stream str. This function uses indent as the amount of space to indent the node.
Sets the node's value to v.
See also nodeValue().
If the node has a namespace prefix, this function changes the namespace prefix of the node to pre. Otherwise this function does nothing.
Only nodes of type ElementNode or AttributeNode can have namespaces. A namespace prefix must have be specified at creation time; it is not possible to add a namespace prefix afterwards.
QDomDocument::createElementNS() QDomDocument::createAttributeNS()
See also prefix(), localName(), and namespaceURI().
Converts a QDomNode into a QDomAttr. If the node is not an attribute, the returned object will be null.
See also isAttr().
Converts a QDomNode into a QDomCDATASection. If the node is not a CDATA section, the returned object will be null.
See also isCDATASection().
Converts a QDomNode into a QDomCharacterData. If the node is not a character data node the returned object will be null.
See also isCharacterData().
Converts a QDomNode into a QDomComment. If the node is not a comment the returned object will be null.
See also isComment().
Converts a QDomNode into a QDomDocument. If the node is not a document the returned object will be null.
See also isDocument().
Converts a QDomNode into a QDomDocumentFragment. If the node is not a document fragment the returned object will be null.
See also isDocumentFragment().
Converts a QDomNode into a QDomDocumentType. If the node is not a document type the returned object will be null.
See also isDocumentType().
Converts a QDomNode into a QDomElement. If the node is not an element the returned object will be null.
See also isElement().
Converts a QDomNode into a QDomEntity. If the node is not an entity the returned object will be null.
See also isEntity().
Converts a QDomNode into a QDomEntityReference. If the node is not an entity reference, the returned object will be null.
See also isEntityReference().
Converts a QDomNode into a QDomNotation. If the node is not a notation the returned object will be null.
See also isNotation().
Converts a QDomNode into a QDomProcessingInstruction. If the node is not a processing instruction the returned object will be null.
See also isProcessingInstruction().
Converts a QDomNode into a QDomText. If the node is not a text, the returned object will be null.
See also isText().
Returns true if n and this DOM node are not equal; otherwise returns false.
Assigns a copy of n to this DOM node.
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().
Returns true if n and this DOM node are equal; otherwise returns false.
This is an overloaded member function, provided for convenience.
Writes the XML representation of the node node and all its children to the stream str.
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.1 | |
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