Qt Jambi Home

com.trolltech.qt.xml
Class QDomNode

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.xml.QDomNode
All Implemented Interfaces:
QtJambiInterface
Direct Known Subclasses:
QDomAttr, QDomCharacterData, QDomDocument, QDomDocumentFragment, QDomDocumentType, QDomElement, QDomEntity, QDomEntityReference, QDomNotation, QDomProcessingInstruction

public class QDomNode
extends QtJambiObject

The QDomNode class is the base class for all the nodes in a DOM tree.

Many functions in the DOM return a QDomNode.

You can find out the type of a node using isAttr, isCDATASection, isDocumentFragment, isDocument, isDocumentType, isElement, isEntityReference, isText, isEntity, isNotation, isProcessingInstruction, isCharacterData and isComment.

A QDomNode can be converted into one of its subclasses using toAttr, toCDATASection, toDocumentFragment, toDocument, toDocumentType, toElement, toEntityReference, toText, toEntity, toNotation, toProcessingInstruction, toCharacterData or toComment. You can convert a node to a null node with clear.

Copies of the QDomNode class share their data using explicit sharing. This means that modifying one node will change all copies. This is especially useful in combination with functions which return a QDomNode, e.g. firstChild. You can make an independent (deep) copy of the node with cloneNode.

A QDomNode can be null, much like a null pointer. Creating a copy of a null node results in another null node. It is not possible to modify a null node, but it is possible to assign another, possibly non-null node to it. In this case, the copy of the null node will remain null. You can check if a QDomNode is null by calling isNull. The empty constructor of a QDomNode (or any of the derived classes) creates a null node.

Nodes are inserted with insertBefore, insertAfter or appendChild. You can replace one node with another using replaceChild and remove a node with removeChild.

To traverse nodes use firstChild to get a node's first child (if any), and nextSibling to traverse. QDomNode also provides lastChild, previousSibling and parentNode. To find the first child node with a particular node name use namedItem.

To find out if a node has children use hasChildNodes and to get a list of all of a node's children use childNodes.

The node's name and value (the meaning of which varies depending on its type) is returned by nodeName and nodeValue respectively. The node's type is returned by nodeType. The node's value can be set with setNodeValue.

The document to which the node belongs is returned by ownerDocument.

Adjacent QDomText nodes can be merged into a single node with normalize.

QDomElement nodes have attributes which can be retrieved with attributes().

QDomElement and QDomAttr nodes can have namespaces which can be retrieved with namespaceURI. Their local name is retrieved with localName, and their prefix with prefix. The prefix can be set with setPrefix.

You can write the XML representation of the node to a text stream with save.

The following example looks for the first element in an XML document and prints the names of all the elements that are its direct children.

    QDomDocument d;
    d.setContent(someXML);
    QDomNode n = d.firstChild();
    while (!n.isNull()) {
        if (n.isElement()) {
            QDomElement e = n.toElement();
            cout << "Element name: " << e.tagName() << endl;
            break;
        }
        n = n.nextSibling();
    }

For further information about the Document Object Model see Level 1 and Level 2 Core. For a more general introduction of the DOM implementation see the QDomDocument documentation.


Nested Class Summary
static class QDomNode.EncodingPolicy
          This enum specifies how QDomNode.:save() determines what encoding to use when serializing.
static class QDomNode.NodeType
          This enum defines the type of the node.
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QDomNode()
          Constructs a null node.
QDomNode(QDomNode arg__1)
          Constructs a copy of arg__1.
 
Method Summary
 QDomNode appendChild(QDomNode newChild)
          Appends newChild as the node's last child.
 QDomNodeList childNodes()
          Returns a list of all direct child nodes.
 void clear()
          Converts the node into a null node; if it was not a null node before, its type and contents are deleted.
 QDomNode cloneNode()
          Equivalent to cloneNode(true).
 QDomNode cloneNode(boolean deep)
          Creates a deep (not shallow) copy of the QDomNode.
 int columnNumber()
          For nodes created by QDomDocument::setContent(), this function returns the column number in the XML document where the node was parsed.
 boolean equals(java.lang.Object other)
          
 QDomNode firstChild()
          Returns the first child of the node.
 QDomElement firstChildElement()
          Equivalent to firstChildElement(QString()).
 QDomElement firstChildElement(java.lang.String tagName)
          Returns the first child element with tag name tagName if tagName is non-empty; otherwise returns the first child element.
static QDomNode fromNativePointer(QNativePointer nativePointer)
          This function returns the QDomNode instance pointed to by nativePointer
 boolean hasAttributes()
          Returns true if the node has attributes; otherwise returns false.
 boolean hasChildNodes()
          Returns true if the node has one or more children; otherwise returns false.
 QDomNode insertAfter(QDomNode newChild, QDomNode refChild)
          Inserts the node newChild after the child node refChild.
 QDomNode insertBefore(QDomNode newChild, QDomNode refChild)
          Inserts the node newChild before the child node refChild.
 boolean isAttr()
          Returns true if the node is an attribute; otherwise returns false.
 boolean isCDATASection()
          Returns true if the node is a CDATA section; otherwise returns false.
 boolean isCharacterData()
          Returns true if the node is a character data node; otherwise returns false.
 boolean isComment()
          Returns true if the node is a comment; otherwise returns false.
 boolean isDocument()
          Returns true if the node is a document; otherwise returns false.
 boolean isDocumentFragment()
          Returns true if the node is a document fragment; otherwise returns false.
 boolean isDocumentType()
          Returns true if the node is a document type; otherwise returns false.
 boolean isElement()
          Returns true if the node is an element; otherwise returns false.
 boolean isEntity()
          Returns true if the node is an entity; otherwise returns false.
 boolean isEntityReference()
          Returns true if the node is an entity reference; otherwise returns false.
 boolean isNotation()
          Returns true if the node is a notation; otherwise returns false.
 boolean isNull()
          Returns true if this node is null (i.e. if it has no type or contents); otherwise returns false.
 boolean isProcessingInstruction()
          Returns true if the node is a processing instruction; otherwise returns false.
 boolean isSupported(java.lang.String feature, java.lang.String version)
          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.
 boolean isText()
          Returns true if the node is a text node; otherwise returns false.
 QDomNode lastChild()
          Returns the last child of the node.
 QDomElement lastChildElement()
          Equivalent to lastChildElement(QString()).
 QDomElement lastChildElement(java.lang.String tagName)
          Returns the last child element with tag name tagName if tagName is non-empty; otherwise returns the first child element.
 int lineNumber()
          For nodes created by QDomDocument::setContent(), this function returns the line number in the XML document where the node was parsed.
 java.lang.String localName()
          If the node uses namespaces, this function returns the local name of the node; otherwise it returns an empty string.
 QDomNode namedItem(java.lang.String name)
          Returns the first direct child node for which nodeName equals name.
 java.lang.String namespaceURI()
          Returns the namespace URI of this node or an empty string if the node has no namespace URI.
static QNativePointer nativePointerArray(QDomNode[] array)
          This function returns a QNativePointer that is pointing to the specified QDomNode array.
 QDomNode nextSibling()
          Returns the next sibling in the document tree.
 QDomElement nextSiblingElement()
          Equivalent to nextSiblingElement(QString()).
 QDomElement nextSiblingElement(java.lang.String taName)
          Returns the next sibilng element with tag name taName if taName is non-empty; otherwise returns any next sibling element.
 java.lang.String nodeName()
          Returns the name of the node.
 QDomNode.NodeType nodeType()
          Returns the type of the node.
 java.lang.String nodeValue()
          Returns the value of the node.
 void normalize()
          Calling normalize on an element converts all its children into a standard form.
 QDomDocument ownerDocument()
          Returns the document to which this node belongs.
 QDomNode parentNode()
          Returns the parent node.
 java.lang.String prefix()
          Returns the namespace prefix of the node or an empty string if the node has no namespace prefix.
 QDomNode previousSibling()
          Returns the previous sibling in the document tree.
 QDomElement previousSiblingElement()
          Equivalent to previousSiblingElement(QString()).
 QDomElement previousSiblingElement(java.lang.String tagName)
          Returns the previous sibilng element with tag name tagName if tagName is non-empty; otherwise returns any previous sibling element.
 QDomNode removeChild(QDomNode oldChild)
          Removes oldChild from the list of children.
 QDomNode replaceChild(QDomNode newChild, QDomNode oldChild)
          Replaces oldChild with newChild.
 void save(QTextStream arg__1, int arg__2)
          Writes the XML representation of the node and all its children to the stream arg__1.
 void save(QTextStream arg__1, int arg__2, QDomNode.EncodingPolicy arg__3)
          If arg__3 is QDomNode::EncodingFromDocument, this function behaves as save(QTextStream &str, int indent).
 void setNodeValue(java.lang.String arg__1)
          Sets the node's value to arg__1.
 void setPrefix(java.lang.String pre)
          If the node has a namespace prefix, this function changes the namespace prefix of the node to pre.
 QDomAttr toAttr()
          Converts a QDomNode into a QDomAttr.
 QDomCDATASection toCDATASection()
          Converts a QDomNode into a QDomCDATASection.
 QDomCharacterData toCharacterData()
          Converts a QDomNode into a QDomCharacterData.
 QDomComment toComment()
          Converts a QDomNode into a QDomComment.
 QDomDocument toDocument()
          Converts a QDomNode into a QDomDocument.
 QDomDocumentFragment toDocumentFragment()
          Converts a QDomNode into a QDomDocumentFragment.
 QDomDocumentType toDocumentType()
          Converts a QDomNode into a QDomDocumentType.
 QDomElement toElement()
          Converts a QDomNode into a QDomElement.
 QDomEntity toEntity()
          Converts a QDomNode into a QDomEntity.
 QDomEntityReference toEntityReference()
          Converts a QDomNode into a QDomEntityReference.
 QDomNotation toNotation()
          Converts a QDomNode into a QDomNotation.
 QDomProcessingInstruction toProcessingInstruction()
          Converts a QDomNode into a QDomProcessingInstruction.
 QDomText toText()
          Converts a QDomNode into a QDomText.
 void writeTo(QTextStream arg__1)
          Writes thisQDomNode to arg__1.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QDomNode

public QDomNode()

Constructs a null node.


QDomNode

public QDomNode(QDomNode arg__1)

Constructs a copy of arg__1.

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.

Method Detail

appendChild

public final QDomNode appendChild(QDomNode newChild)

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.

If newChild is a QDomElement and this node is a QDomDocument that already has an element node as a child, newChild is not added as a child and a null node is returned.

Calling this function on a null node(created, for example, with the default constructor) does nothing.

The DOM specification disallow inserting attribute nodes, but due to historical reasons QDom accept them nevertheless.

See Also:
insertBefore, insertAfter, replaceChild, removeChild

childNodes

public final QDomNodeList childNodes()

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 &lt;h1&gt; tag and the node created by the &lt;p&gt; 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, lastChild

clear

public final void clear()

Converts the node into a null node; if it was not a null node before, its type and contents are deleted.

See Also:
isNull

cloneNode

public final QDomNode cloneNode()

Equivalent to cloneNode(true).


cloneNode

public final QDomNode cloneNode(boolean deep)

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.


columnNumber

public final int columnNumber()

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.

See Also:
lineNumber, QDomDocument::setContent

firstChild

public final QDomNode firstChild()

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, childNodes

firstChildElement

public final QDomElement firstChildElement()

Equivalent to firstChildElement(QString()).


firstChildElement

public final QDomElement firstChildElement(java.lang.String tagName)

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, nextSiblingElement

hasAttributes

public final boolean hasAttributes()

Returns true if the node has attributes; otherwise returns false.

See Also:
attributes

hasChildNodes

public final boolean hasChildNodes()

Returns true if the node has one or more children; otherwise returns false.


insertAfter

public final QDomNode insertAfter(QDomNode newChild,
                                  QDomNode refChild)

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.

The DOM specification disallow inserting attribute nodes, but due to historical reasons QDom accept them nevertheless.

See Also:
insertBefore, replaceChild, removeChild, appendChild

insertBefore

public final QDomNode insertBefore(QDomNode newChild,
                                   QDomNode refChild)

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.

The DOM specification disallow inserting attribute nodes, but due to historical reasons QDom accept them nevertheless.

See Also:
insertAfter, replaceChild, removeChild, appendChild

isAttr

public final boolean isAttr()

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

isCDATASection

public final boolean isCDATASection()

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

isCharacterData

public final boolean isCharacterData()

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

isComment

public final boolean isComment()

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

isDocument

public final boolean isDocument()

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

isDocumentFragment

public final boolean isDocumentFragment()

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

isDocumentType

public final boolean isDocumentType()

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

isElement

public final boolean isElement()

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

isEntity

public final boolean isEntity()

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

isEntityReference

public final boolean isEntityReference()

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

isNotation

public final boolean isNotation()

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

isNull

public final boolean isNull()

Returns true if this node is null (i.e. if it has no type or contents); otherwise returns false.


isProcessingInstruction

public final boolean isProcessingInstruction()

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

isSupported

public final boolean isSupported(java.lang.String feature,
                                 java.lang.String version)

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

isText

public final boolean isText()

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

lastChild

public final QDomNode lastChild()

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, childNodes

lastChildElement

public final QDomElement lastChildElement()

Equivalent to lastChildElement(QString()).


lastChildElement

public final QDomElement lastChildElement(java.lang.String tagName)

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, nextSiblingElement

lineNumber

public final int lineNumber()

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.

See Also:
columnNumber, QDomDocument::setContent

localName

public final java.lang.String localName()

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, QDomDocument::createElementNS

namedItem

public final QDomNode namedItem(java.lang.String name)

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

namespaceURI

public final java.lang.String namespaceURI()

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, QDomDocument::createElementNS

nextSibling

public final QDomNode nextSibling()

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

nextSiblingElement

public final QDomElement nextSiblingElement()

Equivalent to nextSiblingElement(QString()).


nextSiblingElement

public final QDomElement nextSiblingElement(java.lang.String taName)

Returns the next sibilng element with tag name taName if taName is non-empty; otherwise returns any next sibling element. Returns a null element if no such sibling exists.

See Also:
firstChildElement, previousSiblingElement, lastChildElement

nodeName

public final java.lang.String nodeName()

Returns the name of the node.

The meaning of the name depends on the subclass:

NameMeaning
QDomAttrThe name of the attribute
QDomCDATASectionThe string "#cdata-section"
QDomCommentThe string "#comment"
QDomDocumentThe string "#document"
QDomDocumentFragmentThe string "#document-fragment"
QDomDocumentTypeThe name of the document type
QDomElementThe tag name
QDomEntityThe name of the entity
QDomEntityReferenceThe name of the referenced entity
QDomNotationThe name of the notation
QDomProcessingInstructionThe target of the processing instruction
QDomTextThe string "#text"

Note: This function does not take the presence of namespaces into account when processing the names of element and attribute nodes. As a result, the returned name can contain any namespace prefix that may be present. To obtain the node name of an element or attribute, use localName; to obtain the namespace prefix, use namespaceURI.

See Also:
nodeValue

nodeType

public final QDomNode.NodeType nodeType()

Returns the type of the node.

See Also:
toAttr, toCDATASection, toDocumentFragment, toDocument, toDocumentType, toElement, toEntityReference, toText, toEntity, toNotation, toProcessingInstruction, toCharacterData, toComment

nodeValue

public final java.lang.String nodeValue()

Returns the value of the node.

The meaning of the value depends on the subclass:

NameMeaning
QDomAttrThe attribute value
QDomCDATASectionThe content of the CDATA section
QDomCommentThe comment
QDomProcessingInstructionThe data of the processing instruction
QDomTextThe text

All the other subclasses do not have a node value and will return an empty string.

See Also:
setNodeValue, nodeName

normalize

public final void normalize()

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).


writeTo

public final void writeTo(QTextStream arg__1)
Writes thisQDomNode to arg__1.


ownerDocument

public final QDomDocument ownerDocument()

Returns the document to which this node belongs.


parentNode

public final QDomNode parentNode()

Returns the parent node. If this node has no parent, a null node is returned (i.e. a node for which isNull returns true).


prefix

public final java.lang.String prefix()

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, namespaceURI

previousSibling

public final QDomNode previousSibling()

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 &lt;p&gt; tag, previousSibling will return the node representing the &lt;h1&gt; tag.

See Also:
nextSibling

previousSiblingElement

public final QDomElement previousSiblingElement()

Equivalent to previousSiblingElement(QString()).


previousSiblingElement

public final QDomElement previousSiblingElement(java.lang.String tagName)

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, lastChildElement

removeChild

public final QDomNode removeChild(QDomNode oldChild)

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, appendChild

replaceChild

public final QDomNode replaceChild(QDomNode newChild,
                                   QDomNode oldChild)

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, appendChild

save

public final void save(QTextStream arg__1,
                       int arg__2,
                       QDomNode.EncodingPolicy arg__3)

If arg__3 is QDomNode::EncodingFromDocument, this function behaves as save(QTextStream &str, int indent).

If arg__3 is EncodingFromTextStream and this node is a document node, this function behaves as save(QTextStream &str, int indent) with the exception that the encoding specified in the text stream arg__1 is used.

If the document contains invalid XML characters or characters that cannot be encoded in the given encoding, the result and behavior is undefined.


save

public final void save(QTextStream arg__1,
                       int arg__2)

Writes the XML representation of the node and all its children to the stream arg__1. This function uses arg__2 as the amount of space to indent the node.

If this node is a document node, the encoding of text stream arg__1's encoding is set by treating a processing instruction by name "xml" as an XML declaration, if such a one exists, and otherwise defaults to UTF-8. XML declarations are not processing instructions, but this behavior exists for historical reasons. If this node is not a document node, the text stream's encoding is used.

If the document contains invalid XML characters or characters that cannot be encoded in the given encoding, the result and behavior is undefined.


setNodeValue

public final void setNodeValue(java.lang.String arg__1)

Sets the node's value to arg__1.

See Also:
nodeValue

setPrefix

public final void setPrefix(java.lang.String pre)

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, namespaceURI

toAttr

public final QDomAttr toAttr()

Converts a QDomNode into a QDomAttr. If the node is not an attribute, the returned object will be null.

See Also:
isAttr

toCDATASection

public final QDomCDATASection toCDATASection()

Converts a QDomNode into a QDomCDATASection. If the node is not a CDATA section, the returned object will be null.

See Also:
isCDATASection

toCharacterData

public final QDomCharacterData toCharacterData()

Converts a QDomNode into a QDomCharacterData. If the node is not a character data node the returned object will be null.

See Also:
isCharacterData

toComment

public final QDomComment toComment()

Converts a QDomNode into a QDomComment. If the node is not a comment the returned object will be null.

See Also:
isComment

toDocument

public final QDomDocument toDocument()

Converts a QDomNode into a QDomDocument. If the node is not a document the returned object will be null.

See Also:
isDocument

toDocumentFragment

public final QDomDocumentFragment toDocumentFragment()

Converts a QDomNode into a QDomDocumentFragment. If the node is not a document fragment the returned object will be null.

See Also:
isDocumentFragment

toDocumentType

public final QDomDocumentType toDocumentType()

Converts a QDomNode into a QDomDocumentType. If the node is not a document type the returned object will be null.

See Also:
isDocumentType

toElement

public final QDomElement toElement()

Converts a QDomNode into a QDomElement. If the node is not an element the returned object will be null.

See Also:
isElement

toEntity

public final QDomEntity toEntity()

Converts a QDomNode into a QDomEntity. If the node is not an entity the returned object will be null.

See Also:
isEntity

toEntityReference

public final QDomEntityReference toEntityReference()

Converts a QDomNode into a QDomEntityReference. If the node is not an entity reference, the returned object will be null.

See Also:
isEntityReference

toNotation

public final QDomNotation toNotation()

Converts a QDomNode into a QDomNotation. If the node is not a notation the returned object will be null.

See Also:
isNotation

toProcessingInstruction

public final QDomProcessingInstruction toProcessingInstruction()

Converts a QDomNode into a QDomProcessingInstruction. If the node is not a processing instruction the returned object will be null.

See Also:
isProcessingInstruction

toText

public final QDomText toText()

Converts a QDomNode into a QDomText. If the node is not a text, the returned object will be null.

See Also:
isText

fromNativePointer

public static QDomNode fromNativePointer(QNativePointer nativePointer)
This function returns the QDomNode instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QDomNode[] array)
This function returns a QNativePointer that is pointing to the specified QDomNode array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class java.lang.Object

Qt Jambi Home