• PySide 模块
  • PySide.QtXml
  • 内容表

    上一话题

    QDomNodeList

    下一话题

    QDomDocument

    QDomNode

    继承者: QDomDocument , QDomDocumentType , QDomProcessingInstruction , QDomEntityReference , QDomEntity , QDomNotation , QDomElement , QDomAttr , QDomCharacterData , QDomComment , QDomText , QDomCDATASection , QDomDocumentFragment

    概要

    函数

    详细描述

    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 .

    可以找出节点的类型使用 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 ,如 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.

    插入节点采用 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() .

    要遍历节点使用 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() .

    要找出节点是否拥有子级使用 PySide.QtXml.QDomNode.hasChildNodes() and to get a list of all of a node's children use PySide.QtXml.QDomNode.childNodes() .

    节点名称和值 (其含义因类型而异) 的返回通过 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() .

    节点所属文档的返回通过 PySide.QtXml.QDomNode.ownerDocument() .

    相邻 PySide.QtXml.QDomText 节点可以合并成单个节点采用 PySide.QtXml.QDomNode.normalize() .

    PySide.QtXml.QDomElement 可以检索节点拥有的属性采用 PySide.QtXml.QDomNode.attributes() .

    PySide.QtXml.QDomElement and PySide.QtXml.QDomAttr 节点可以拥有可以检索的名称空间采用 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() .

    可以将节点的 XML 表示写入文本流采用 PySide.QtXml.QDomNode.save() .

    以下范例查找 XML 文档第一元素并打印其直接子级所有元素的名称。

    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 文档编制。

    class PySide.QtXml. QDomNode
    class PySide.QtXml. QDomNode ( arg__1 )
    参数: arg__1 PySide.QtXml.QDomNode

    构造 null 节点。

    构造副本为 n .

    拷贝数据是共享的 (浅拷贝):修改一个节点也将改变另一节点。若想要制作深度副本,使用 PySide.QtXml.QDomNode.cloneNode() .

    PySide.QtXml.QDomNode. NodeType

    此枚举定义节点的类型:

    常量 描述
    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 对象,即不是 PySide.QtXml.QDomNode 子类。
    QDomNode.CharacterDataNode  
    PySide.QtXml.QDomNode. EncodingPolicy

    此枚举指定如何 QDomNode.save() determines what encoding to use when serializing.

    常量 描述
    QDomNode.EncodingFromDocument 编码抓取自文档。
    QDomNode.EncodingFromTextStream 编码抓取自 PySide.QtCore.QTextStream .

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

    PySide.QtXml.QDomNode. appendChild ( newChild )
    参数: newChild PySide.QtXml.QDomNode
    返回类型: PySide.QtXml.QDomNode

    追加 newChild 作为节点的最后子级。

    newChild 是另一节点的子级,它会重设父级到此节点。若 newChild 是此节点的子级,那么它在子级列表中的位置会改变。

    newChild PySide.QtXml.QDomDocumentFragment ,那么片段的子级将从片段中移除并追加。

    newChild PySide.QtXml.QDomElement 和此节点是 PySide.QtXml.QDomDocument ,已经拥有的元素节点将作为子级, newChild 不添加作为子级并返回 null 节点。

    返回新的引用为 newChild 当成功时或 null node 当失败时。

    在 null 节点 (例如:采用默认构造函数创建) 调用此函数什么都不做并返回 null node .

    DOM 规范禁止插入属性节点,但由于历史原因,无论如何 QDom 接受它们。

    PySide.QtXml.QDomNode. attributes ( )
    返回类型: PySide.QtXml.QDomNamedNodeMap

    返回所有属性的命名节点映射。才提供属性对于 PySide.QtXml.QDomElement s.

    改变映射中的属性也会改变其属性对于此 PySide.QtXml.QDomNode .

    PySide.QtXml.QDomNode. childNodes ( )
    返回类型: PySide.QtXml.QDomNodeList

    返回所有直接子级节点的列表。

    大多数情况下,会调用此函数在 PySide.QtXml.QDomElement 对象。

    例如,若 XML 文档看起来像这样:

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

    列表中的节点不是副本;因此改变列表中的节点也会改变此节点的子级。

    PySide.QtXml.QDomNode. clear ( )

    将节点转换为 null 节点;若它之前不是 null 节点,删除其类型和内容。

    PySide.QtXml.QDomNode. cloneNode ( [ deep=true ] )
    参数: deep PySide.QtCore.bool
    返回类型: PySide.QtXml.QDomNode

    创建深 (非浅) 副本为 PySide.QtXml.QDomNode .

    deep 为 true,那么会递归完成克隆,意味着所有节点的子级也被深拷贝。若 deep 为 false 仅节点本身被拷贝且副本没有子级节点。

    PySide.QtXml.QDomNode. columnNumber ( )
    返回类型: PySide.QtCore.int

    对于创建的节点通过 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 ( )
    返回类型: PySide.QtXml.QDomNode

    返回节点的第一子级。若没有子级节点, null node 被返回。改变返回节点也会改变文档树节点。

    PySide.QtXml.QDomNode. firstChildElement ( [ tagName="" ] )
    参数: tagName – unicode
    返回类型: PySide.QtXml.QDomElement

    返回的第一子级元素具有标签名称 tagName 若 tagName 非空; 否则返回第一子级元素。返回 null 元素若不存在这样的子级。

    PySide.QtXml.QDomNode. hasAttributes ( )
    返回类型: PySide.QtCore.bool

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

    PySide.QtXml.QDomNode. hasChildNodes ( )
    返回类型: PySide.QtCore.bool

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

    PySide.QtXml.QDomNode. insertAfter ( newChild , refChild )
    参数:
    返回类型:

    PySide.QtXml.QDomNode

    插入节点 newChild 后于子级节点 refChild . refChild 必须是此节点的直接子级。若 refChild is null then newChild 被追加作为此节点的最后子级。

    newChild 是另一节点的子级,它会重设父级到此节点。若 newChild 是此节点的子级,那么它在子级列表中的位置会改变。

    newChild PySide.QtXml.QDomDocumentFragment ,那么片段的子级将从片段被移除并插入后于 refChild .

    返回新的引用为 newChild 当成功时或 null node 当失败时。

    DOM 规范禁止插入属性节点,但由于历史原因 QDom 仍然接受它们。

    PySide.QtXml.QDomNode. insertBefore ( newChild , refChild )
    参数:
    返回类型:

    PySide.QtXml.QDomNode

    插入节点 newChild 前于子级节点 refChild . refChild 必须是此节点的直接子级。若 refChild is null then newChild 被插入作为节点的第一子级。

    newChild 是另一节点的子级,它会重设父级到此节点。若 newChild 是此节点的子级,那么它在子级列表中的位置会改变。

    newChild PySide.QtXml.QDomDocumentFragment ,那么片段的子级将从片段被移除并插入前于 refChild .

    返回新的引用为 newChild 当成功时或 null node 当失败时。

    DOM 规范禁止插入属性节点,但由于历史原因 QDom 仍然接受它们。

    PySide.QtXml.QDomNode. isAttr ( )
    返回类型: 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 ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomCDATASection with PySide.QtXml.QDomNode.toCDATASection() .

    PySide.QtXml.QDomNode. isCharacterData ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomCharacterData with PySide.QtXml.QDomNode.toCharacterData() .

    PySide.QtXml.QDomNode. isComment ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomComment with PySide.QtXml.QDomNode.toComment() .

    PySide.QtXml.QDomNode. isDocument ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomDocument with PySide.QtXml.QDomNode.toDocument() .

    PySide.QtXml.QDomNode. isDocumentFragment ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomDocumentFragment with PySide.QtXml.QDomNode.toDocumentFragment() .

    PySide.QtXml.QDomNode. isDocumentType ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomDocumentType with PySide.QtXml.QDomNode.toDocumentType() .

    PySide.QtXml.QDomNode. isElement ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomElement with PySide.QtXml.QDomNode.toElement() .

    PySide.QtXml.QDomNode. isEntity ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomEntity with PySide.QtXml.QDomNode.toEntity() .

    PySide.QtXml.QDomNode. isEntityReference ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomEntityReference with PySide.QtXml.QDomNode.toEntityReference() .

    PySide.QtXml.QDomNode. isNotation ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomNotation with PySide.QtXml.QDomNode.toNotation() .

    PySide.QtXml.QDomNode. isNull ( )
    返回类型: 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 ( )
    返回类型: 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 ;可以获取 QProcessingInstruction 采用 PySide.QtXml.QDomNode.toProcessingInstruction() .

    PySide.QtXml.QDomNode. isSupported ( feature , version )
    参数:
    • feature – unicode
    • version – unicode
    返回类型:

    PySide.QtCore.bool

    Returns true if the DOM implementation implements the feature feature 且此特征由此节点支持在版本 version ;否则返回 false。

    PySide.QtXml.QDomNode. isText ( )
    返回类型: 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 ;可以获取 PySide.QtXml.QDomText with PySide.QtXml.QDomNode.toText() .

    PySide.QtXml.QDomNode. lastChild ( )
    返回类型: PySide.QtXml.QDomNode

    返回节点的最后子级。若没有子级节点, null node 被返回。改变返回节点也会改变文档树节点。

    PySide.QtXml.QDomNode. lastChildElement ( [ tagName="" ] )
    参数: tagName – unicode
    返回类型: PySide.QtXml.QDomElement

    返回的最后子级元素具有标签名称 tagName 若 tagName 非空;否则返回最后子级元素。返回 null 元素,若不存在这种子级。

    PySide.QtXml.QDomNode. lineNumber ( )
    返回类型: PySide.QtCore.int

    对于创建的节点通过 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 ( )
    返回类型: unicode

    若节点使用名称空间,此函数返回节点的本地名称;否则它返回空字符串。

    仅节点为类型 ElementNode or AttributeNode 可以拥有名称空间。名称空间必须在创建时指定;之后添加名称空间不可能。

    QDomDocument.createAttributeNS()

    PySide.QtXml.QDomNode. namedItem ( name )
    参数: name – unicode
    返回类型: PySide.QtXml.QDomNode

    返回第一直接子级节点对于其 PySide.QtXml.QDomNode.nodeName() 等于 name .

    若不存在这种直接子级, null node 被返回。

    PySide.QtXml.QDomNode. namespaceURI ( )
    返回类型: unicode

    返回此节点的名称空间 URI 或空字符串,若节点没有名称空间 URI。

    仅节点为类型 ElementNode or AttributeNode 可以拥有名称空间。名称空间 URI 必须在创建时指定且以后不能更改。

    QDomDocument.createAttributeNS()

    PySide.QtXml.QDomNode. nextSibling ( )
    返回类型: PySide.QtXml.QDomNode

    返回文档树中的下一同级。改变返回节点还会改变文档树中的节点。

    若拥有的 XML 像这样:

    <h1>Heading</h1>
    <p>The text...</p>
    <h2>Next heading</h2>
    										

    和此 PySide.QtXml.QDomNode represents the <p> tag, PySide.QtXml.QDomNode.nextSibling() will return the node representing the <h2> tag.

    PySide.QtXml.QDomNode. nextSiblingElement ( [ taName="" ] )
    参数: taName – unicode
    返回类型: PySide.QtXml.QDomElement

    返回的下一同级元素具有标签名称 tagName if tagName 非空;否则返回任何下一同级元素。返回 null 元素,若不存在这种同级。

    PySide.QtXml.QDomNode. nodeName ( )
    返回类型: unicode

    返回节点的名称。

    名称的含义从属子类:

    Name 含义
    PySide.QtXml.QDomAttr 属性名称
    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 文件类型的名称
    PySide.QtXml.QDomElement 标签名称
    PySide.QtXml.QDomEntity 实体名称
    PySide.QtXml.QDomEntityReference 引用实体的名称
    PySide.QtXml.QDomNotation 表示法名称
    PySide.QtXml.QDomProcessingInstruction 处理指令的目标
    PySide.QtXml.QDomText The string “#text”

    注意

    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 ( )
    返回类型: PySide.QtXml.QDomNode.NodeType

    返回节点的类型。

    PySide.QtXml.QDomNode. nodeValue ( )
    返回类型: unicode

    返回节点的值。

    值的含义从属子类:

    Name 含义
    PySide.QtXml.QDomAttr 属性值
    PySide.QtXml.QDomCDATASection CDATA 区间的内容
    PySide.QtXml.QDomComment 注释
    PySide.QtXml.QDomProcessingInstruction 处理指令的数据
    PySide.QtXml.QDomText 文本

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

    PySide.QtXml.QDomNode. normalize ( )

    调用 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 )
    参数: arg__1 PySide.QtXml.QDomNode
    返回类型: PySide.QtCore.bool

    返回 true 若 n and this DOM node are not equal; otherwise returns false.

    PySide.QtXml.QDomNode. __eq__ ( arg__1 )
    参数: arg__1 PySide.QtXml.QDomNode
    返回类型: PySide.QtCore.bool

    返回 true 若 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
    										

    2 节点 ( PySide.QtXml.QDomElement 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 ( )
    返回类型: PySide.QtXml.QDomDocument

    返回此节点所属的文档。

    PySide.QtXml.QDomNode. parentNode ( )
    返回类型: PySide.QtXml.QDomNode

    返回父级节点。若此节点没有父级,返回 null 节点 (即:节点的 PySide.QtXml.QDomNode.isNull() returns true).

    PySide.QtXml.QDomNode. prefix ( )
    返回类型: unicode

    返回节点名称空间前缀,或空字符串若节点没有名称空间前缀。

    仅节点为类型 ElementNode or AttributeNode 可以拥有名称空间。必须在创建时指定名称空间前缀。若节点是采用名称空间前缀创建的,可以稍后改变它采用 PySide.QtXml.QDomNode.setPrefix() .

    如果创建元素或属性采用 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 ( )
    返回类型: PySide.QtXml.QDomNode

    返回文档树的上一同级。改变返回节点也会改变文档树节点。

    例如,若拥有的 XML 像这样:

    <h1>Heading</h1>
    <p>The text...</p>
    <h2>Next heading</h2>
    										

    和此 PySide.QtXml.QDomNode represents the <p> tag, PySide.QtXml.QDomNode.previousSibling() will return the node representing the <h1> tag.

    PySide.QtXml.QDomNode. previousSiblingElement ( [ tagName="" ] )
    参数: tagName – unicode
    返回类型: PySide.QtXml.QDomElement

    返回的上一同级元素具有标签名称 tagName if tagName 非空;否则返回任何先前同级元素。返回 null 元素若不存在这样的同级。

    PySide.QtXml.QDomNode. removeChild ( oldChild )
    参数: oldChild PySide.QtXml.QDomNode
    返回类型: PySide.QtXml.QDomNode

    移除 oldChild from the list of children. oldChild 必须是此节点的直接子级。

    返回新的引用为 oldChild 当成功时或 null node 当失败时。

    PySide.QtXml.QDomNode. replaceChild ( newChild , oldChild )
    参数:
    返回类型:

    PySide.QtXml.QDomNode

    替换 oldChild with newChild . oldChild 必须是此节点的直接子级。

    newChild 是另一节点的子级,它会重设父级到此节点。若 newChild 是此节点的子级,那么它在子级列表中的位置会改变。

    newChild PySide.QtXml.QDomDocumentFragment ,那么 oldChild 被片段的所有子级所替换。

    返回新的引用为 oldChild 当成功时或 null node an failure.

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

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

    encodingPolicy is EncodingFromTextStream 和此节点是文档节点,此函数行为如 save( PySide.QtCore.QTextStream &str, int indent) 除了指定编码在文本流 str 被使用。

    若文档包含无效 XML 字符或不能以给定编码编码字符,结果和行为未定义。

    PySide.QtXml.QDomNode. save ( arg__1 , arg__2 )
    参数:

    将节点及其所有子级的 XML 表示写入流 str 。此函数使用 indent 作为节点的缩进空格数。

    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.

    若文档包含无效 XML 字符或不能以给定编码编码字符,结果和行为未定义。

    PySide.QtXml.QDomNode. setNodeValue ( arg__1 )
    参数: arg__1 – unicode

    将节点值设为 v .

    PySide.QtXml.QDomNode. setPrefix ( pre )
    参数: pre – unicode

    若节点拥有名称空间前缀,此函数将节点名称空间前缀改为 pre 。否则此函数什么都不做。

    仅节点为类型 ElementNode or AttributeNode 可以拥有名称空间。必须在创建时指定名称空间前缀;之后添加名称空间前缀是不可能的。

    QDomDocument.createElementNS() QDomDocument.createAttributeNS()

    PySide.QtXml.QDomNode. toAttr ( )
    返回类型: PySide.QtXml.QDomAttr

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomAttr 。若节点不是属性,返回对象将是 null .

    PySide.QtXml.QDomNode. toCDATASection ( )
    返回类型: PySide.QtXml.QDomCDATASection

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomCDATASection 。若节点不是 CDATA 区间,返回对象将是 null .

    PySide.QtXml.QDomNode. toCharacterData ( )
    返回类型: PySide.QtXml.QDomCharacterData

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomCharacterData 。若节点不是字符数据,返回对象将是 null .

    PySide.QtXml.QDomNode. toComment ( )
    返回类型: PySide.QtXml.QDomComment

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomComment 。若节点不是注释,返回对象将是 null .

    PySide.QtXml.QDomNode. toDocument ( )
    返回类型: PySide.QtXml.QDomDocument

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomDocument 。若节点不是文档,返回对象将是 null .

    PySide.QtXml.QDomNode. toDocumentFragment ( )
    返回类型: PySide.QtXml.QDomDocumentFragment

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomDocumentFragment 。若节点不是文档片段,返回对象将是 null .

    PySide.QtXml.QDomNode. toDocumentType ( )
    返回类型: PySide.QtXml.QDomDocumentType

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomDocumentType 。若节点不是文档类型,返回对象将是 null .

    PySide.QtXml.QDomNode. toElement ( )
    返回类型: PySide.QtXml.QDomElement

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomElement 。若节点不是元素,返回对象将是 null .

    PySide.QtXml.QDomNode. toEntity ( )
    返回类型: PySide.QtXml.QDomEntity

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomEntity 。若节点不是实体,返回对象将是 null .

    PySide.QtXml.QDomNode. toEntityReference ( )
    返回类型: PySide.QtXml.QDomEntityReference

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomEntityReference 。若节点不是实体引用,返回对象将是 null .

    PySide.QtXml.QDomNode. toNotation ( )
    返回类型: PySide.QtXml.QDomNotation

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomNotation 。若节点不是表示法,返回对象将是 null .

    PySide.QtXml.QDomNode. toProcessingInstruction ( )
    返回类型: PySide.QtXml.QDomProcessingInstruction

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomProcessingInstruction 。若节点不是处理指令,返回对象将是 null .

    PySide.QtXml.QDomNode. toText ( )
    返回类型: PySide.QtXml.QDomText

    转换 PySide.QtXml.QDomNode PySide.QtXml.QDomText 。若节点不是文本,返回对象将是 null .