Table Of Contents

Previous topic

QDomNodeList

Next topic

QDomProcessingInstruction

QDomNode

Inheritance diagram of QDomNode

Inherited by: QDomProcessingInstruction, QDomEntityReference, QDomEntity, QDomNotation, QDomElement, QDomAttr, QDomCharacterData, QDomComment, QDomText, QDomCDATASection, QDomDocumentFragment, QDomDocument, QDomDocumentType

Synopsis

Functions

Detailed Description

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

Many functions in the DOM return a PySide.QtXml.QDomNode .

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

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

Copies of the PySide.QtXml.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 PySide.QtXml.QDomNode , e.g. PySide.QtXml.QDomNode.firstChild() . You can make an independent (deep) copy of the node with PySide.QtXml.QDomNode.cloneNode() .

A PySide.QtXml.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 PySide.QtXml.QDomNode is null by calling PySide.QtXml.QDomNode.isNull() . The empty constructor of a PySide.QtXml.QDomNode (or any of the derived classes) creates a null node.

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

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

To find out if a node has children use PySide.QtXml.QDomNode.hasChildNodes() and to get a list of all of a node’s children use PySide.QtXml.QDomNode.childNodes() .

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

The document to which the node belongs is returned by PySide.QtXml.QDomNode.ownerDocument() .

Adjacent PySide.QtXml.QDomText nodes can be merged into a single node with PySide.QtXml.QDomNode.normalize() .

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

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

You can write the XML representation of the node to a text stream with PySide.QtXml.QDomNode.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.

d = QDomDocument()
d.setContent(someXML)
n = d.firstChild()
while !n.isNull():
    if n.isElement():
        e = n.toElement()
        print "Element name: %s" % e.tagName()
        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 PySide.QtXml.QDomDocument documentation.

class PySide.QtXml.QDomNode
class PySide.QtXml.QDomNode(arg__1)
Parameters:arg__1PySide.QtXml.QDomNode

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 PySide.QtXml.QDomNode.cloneNode() .

PySide.QtXml.QDomNode.NodeType

This enum defines the type of the node:

Constant Description
QDomNode.ElementNode  
QDomNode.AttributeNode  
QDomNode.TextNode  
QDomNode.CDATASectionNode  
QDomNode.EntityReferenceNode  
QDomNode.EntityNode  
QDomNode.ProcessingInstructionNode  
QDomNode.CommentNode  
QDomNode.DocumentNode  
QDomNode.DocumentTypeNode  
QDomNode.DocumentFragmentNode  
QDomNode.NotationNode  
QDomNode.BaseNode A PySide.QtXml.QDomNode object, i.e. not a PySide.QtXml.QDomNode subclass.
QDomNode.CharacterDataNode  
PySide.QtXml.QDomNode.EncodingPolicy

This enum specifies how QDomNode.save() determines what encoding to use when serializing.

Constant Description
QDomNode.EncodingFromDocument The encoding is fetched from the document.
QDomNode.EncodingFromTextStream The encoding is fetched from the PySide.QtCore.QTextStream .

See also the overload of the PySide.QtXml.QDomNode.save() function that takes an QDomNode.EncodingPolicy .

PySide.QtXml.QDomNode.appendChild(newChild)
Parameters:newChildPySide.QtXml.QDomNode
Return type:PySide.QtXml.QDomNode

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 PySide.QtXml.QDomDocumentFragment , then the children of the fragment are removed from the fragment and appended.

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

Returns a new reference to newChild on success or a null node on failure.

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

The DOM specification disallow inserting attribute nodes, but for historical reasons, QDom accepts them anyway.

PySide.QtXml.QDomNode.attributes()
Return type:PySide.QtXml.QDomNamedNodeMap

Returns a named node map of all attributes. Attributes are only provided for PySide.QtXml.QDomElement s.

Changing the attributes in the map will also change the attributes of this PySide.QtXml.QDomNode .

PySide.QtXml.QDomNode.childNodes()
Return type:PySide.QtXml.QDomNodeList

Returns a list of all direct child nodes.

Most often you will call this function on a PySide.QtXml.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.

PySide.QtXml.QDomNode.clear()

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

PySide.QtXml.QDomNode.cloneNode([deep=true])
Parameters:deepPySide.QtCore.bool
Return type:PySide.QtXml.QDomNode

Creates a deep (not shallow) copy of the PySide.QtXml.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.

PySide.QtXml.QDomNode.columnNumber()
Return type:PySide.QtCore.int

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.

PySide.QtXml.QDomNode.firstChild()
Return type:PySide.QtXml.QDomNode

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.

PySide.QtXml.QDomNode.firstChildElement([tagName=""])
Parameters:tagName – unicode
Return type:PySide.QtXml.QDomElement

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.

PySide.QtXml.QDomNode.hasAttributes()
Return type:PySide.QtCore.bool

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

PySide.QtXml.QDomNode.hasChildNodes()
Return type:PySide.QtCore.bool

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

PySide.QtXml.QDomNode.insertAfter(newChild, refChild)
Parameters:
Return type:

PySide.QtXml.QDomNode

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 PySide.QtXml.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.

PySide.QtXml.QDomNode.insertBefore(newChild, refChild)
Parameters:
Return type:

PySide.QtXml.QDomNode

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 PySide.QtXml.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.

PySide.QtXml.QDomNode.isAttr()
Return type:PySide.QtCore.bool

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

PySide.QtXml.QDomNode.isCDATASection()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomCDATASection ; you can get the PySide.QtXml.QDomCDATASection with PySide.QtXml.QDomNode.toCDATASection() .

PySide.QtXml.QDomNode.isCharacterData()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomCharacterData ; you can get the PySide.QtXml.QDomCharacterData with PySide.QtXml.QDomNode.toCharacterData() .

PySide.QtXml.QDomNode.isComment()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomComment ; you can get the PySide.QtXml.QDomComment with PySide.QtXml.QDomNode.toComment() .

PySide.QtXml.QDomNode.isDocument()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomDocument ; you can get the PySide.QtXml.QDomDocument with PySide.QtXml.QDomNode.toDocument() .

PySide.QtXml.QDomNode.isDocumentFragment()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomDocumentFragment ; you can get the PySide.QtXml.QDomDocumentFragment with PySide.QtXml.QDomNode.toDocumentFragment() .

PySide.QtXml.QDomNode.isDocumentType()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomDocumentType ; you can get the PySide.QtXml.QDomDocumentType with PySide.QtXml.QDomNode.toDocumentType() .

PySide.QtXml.QDomNode.isElement()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomElement ; you can get the PySide.QtXml.QDomElement with PySide.QtXml.QDomNode.toElement() .

PySide.QtXml.QDomNode.isEntity()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomEntity ; you can get the PySide.QtXml.QDomEntity with PySide.QtXml.QDomNode.toEntity() .

PySide.QtXml.QDomNode.isEntityReference()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomEntityReference ; you can get the PySide.QtXml.QDomEntityReference with PySide.QtXml.QDomNode.toEntityReference() .

PySide.QtXml.QDomNode.isNotation()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomNotation ; you can get the PySide.QtXml.QDomNotation with PySide.QtXml.QDomNode.toNotation() .

PySide.QtXml.QDomNode.isNull()
Return type:PySide.QtCore.bool

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

PySide.QtXml.QDomNode.isProcessingInstruction()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomProcessingInstruction ; you can get the QProcessingInstruction with PySide.QtXml.QDomNode.toProcessingInstruction() .

PySide.QtXml.QDomNode.isSupported(feature, version)
Parameters:
  • feature – unicode
  • version – unicode
Return type:

PySide.QtCore.bool

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.

PySide.QtXml.QDomNode.isText()
Return type:PySide.QtCore.bool

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 PySide.QtXml.QDomText ; you can get the PySide.QtXml.QDomText with PySide.QtXml.QDomNode.toText() .

PySide.QtXml.QDomNode.lastChild()
Return type:PySide.QtXml.QDomNode

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.

PySide.QtXml.QDomNode.lastChildElement([tagName=""])
Parameters:tagName – unicode
Return type:PySide.QtXml.QDomElement

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.

PySide.QtXml.QDomNode.lineNumber()
Return type:PySide.QtCore.int

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.

PySide.QtXml.QDomNode.localName()
Return type:unicode

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

PySide.QtXml.QDomNode.namedItem(name)
Parameters:name – unicode
Return type:PySide.QtXml.QDomNode

Returns the first direct child node for which PySide.QtXml.QDomNode.nodeName() equals name .

If no such direct child exists, a null node is returned.

PySide.QtXml.QDomNode.namespaceURI()
Return type:unicode

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

PySide.QtXml.QDomNode.nextSibling()
Return type:PySide.QtXml.QDomNode

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 PySide.QtXml.QDomNode represents the <p> tag, PySide.QtXml.QDomNode.nextSibling() will return the node representing the <h2> tag.

PySide.QtXml.QDomNode.nextSiblingElement([taName=""])
Parameters:taName – unicode
Return type:PySide.QtXml.QDomElement

Returns the next sibling 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.

PySide.QtXml.QDomNode.nodeName()
Return type:unicode

Returns the name of the node.

The meaning of the name depends on the subclass:

Name Meaning
PySide.QtXml.QDomAttr The name of the attribute
PySide.QtXml.QDomCDATASection The string “#cdata-section”
PySide.QtXml.QDomComment The string “#comment”
PySide.QtXml.QDomDocument The string “#document”
PySide.QtXml.QDomDocumentFragment The string “#document-fragment”
PySide.QtXml.QDomDocumentType The name of the document type
PySide.QtXml.QDomElement The tag name
PySide.QtXml.QDomEntity The name of the entity
PySide.QtXml.QDomEntityReference The name of the referenced entity
PySide.QtXml.QDomNotation The name of the notation
PySide.QtXml.QDomProcessingInstruction The target of the processing instruction
PySide.QtXml.QDomText The 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 PySide.QtXml.QDomNode.localName() ; to obtain the namespace prefix, use PySide.QtXml.QDomNode.namespaceURI() .

PySide.QtXml.QDomNode.nodeType()
Return type:PySide.QtXml.QDomNode.NodeType

Returns the type of the node.

PySide.QtXml.QDomNode.nodeValue()
Return type:unicode

Returns the value of the node.

The meaning of the value depends on the subclass:

Name Meaning
PySide.QtXml.QDomAttr The attribute value
PySide.QtXml.QDomCDATASection The content of the CDATA section
PySide.QtXml.QDomComment The comment
PySide.QtXml.QDomProcessingInstruction The data of the processing instruction
PySide.QtXml.QDomText The text

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

PySide.QtXml.QDomNode.normalize()

Calling PySide.QtXml.QDomNode.normalize() on an element converts all its children into a standard form. This means that adjacent PySide.QtXml.QDomText objects will be merged into a single text object ( PySide.QtXml.QDomCDATASection nodes are not merged).

PySide.QtXml.QDomNode.__ne__(arg__1)
Parameters:arg__1PySide.QtXml.QDomNode
Return type:PySide.QtCore.bool

Returns true if n and this DOM node are not equal; otherwise returns false.

PySide.QtXml.QDomNode.__eq__(arg__1)
Parameters:arg__1PySide.QtXml.QDomNode
Return type:PySide.QtCore.bool

Returns true if n and this DOM node are equal; otherwise returns false.

Any instance of PySide.QtXml.QDomNode acts as a reference to an underlying data structure in PySide.QtXml.QDomDocument . The test for equality checks if the two references point to the same underlying node. For example:

QDomDocument document
QDomElement element1 = document.documentElement()
QDomElement element2 = element1

The two nodes ( PySide.QtXml.QDomElement is a PySide.QtXml.QDomNode subclass) both refer to the document’s root element, and element1 == element2 will return true. On the other hand:

QDomElement element3 = document.createElement("MyElement")
QDomElement element4 = document.createElement("MyElement")

Even though both nodes are empty elements carrying the same name, element3 == element4 will return false because they refer to two different nodes in the underlying data structure.

PySide.QtXml.QDomNode.ownerDocument()
Return type:PySide.QtXml.QDomDocument

Returns the document to which this node belongs.

PySide.QtXml.QDomNode.parentNode()
Return type:PySide.QtXml.QDomNode

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

PySide.QtXml.QDomNode.prefix()
Return type:unicode

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 PySide.QtXml.QDomNode.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()

PySide.QtXml.QDomNode.previousSibling()
Return type:PySide.QtXml.QDomNode

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 PySide.QtXml.QDomNode represents the &lt;p&gt; tag, PySide.QtXml.QDomNode.previousSibling() will return the node representing the &lt;h1&gt; tag.

PySide.QtXml.QDomNode.previousSiblingElement([tagName=""])
Parameters:tagName – unicode
Return type:PySide.QtXml.QDomElement

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.

PySide.QtXml.QDomNode.removeChild(oldChild)
Parameters:oldChildPySide.QtXml.QDomNode
Return type:PySide.QtXml.QDomNode

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.

PySide.QtXml.QDomNode.replaceChild(newChild, oldChild)
Parameters:
Return type:

PySide.QtXml.QDomNode

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 PySide.QtXml.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.

PySide.QtXml.QDomNode.save(arg__1, arg__2, arg__3)
Parameters:

If encodingPolicy is QDomNode.EncodingFromDocument , this function behaves as save( PySide.QtCore.QTextStream &str, int indent).

If encodingPolicy is EncodingFromTextStream and this node is a document node, this function behaves as save( PySide.QtCore.QTextStream &str, int indent) with the exception that the encoding specified in the text stream str 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.

PySide.QtXml.QDomNode.save(arg__1, arg__2)
Parameters:

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.

If this node is a document node, the encoding of text stream str ‘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.

PySide.QtXml.QDomNode.setNodeValue(arg__1)
Parameters:arg__1 – unicode

Sets the node’s value to v .

PySide.QtXml.QDomNode.setPrefix(pre)
Parameters:pre – unicode

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

PySide.QtXml.QDomNode.toAttr()
Return type:PySide.QtXml.QDomAttr

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

PySide.QtXml.QDomNode.toCDATASection()
Return type:PySide.QtXml.QDomCDATASection

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

PySide.QtXml.QDomNode.toCharacterData()
Return type:PySide.QtXml.QDomCharacterData

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

PySide.QtXml.QDomNode.toComment()
Return type:PySide.QtXml.QDomComment

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

PySide.QtXml.QDomNode.toDocument()
Return type:PySide.QtXml.QDomDocument

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

PySide.QtXml.QDomNode.toDocumentFragment()
Return type:PySide.QtXml.QDomDocumentFragment

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

PySide.QtXml.QDomNode.toDocumentType()
Return type:PySide.QtXml.QDomDocumentType

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

PySide.QtXml.QDomNode.toElement()
Return type:PySide.QtXml.QDomElement

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

PySide.QtXml.QDomNode.toEntity()
Return type:PySide.QtXml.QDomEntity

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

PySide.QtXml.QDomNode.toEntityReference()
Return type:PySide.QtXml.QDomEntityReference

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

PySide.QtXml.QDomNode.toNotation()
Return type:PySide.QtXml.QDomNotation

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

PySide.QtXml.QDomNode.toProcessingInstruction()
Return type:PySide.QtXml.QDomProcessingInstruction

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

PySide.QtXml.QDomNode.toText()
Return type:PySide.QtXml.QDomText

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