QDomNamedNodeMap¶
The
QDomNamedNodeMap
class contains a collection of nodes that can be accessed by name. More…
Synopsis¶
Functions¶
def
__eq__
(arg__1)def
__ne__
(arg__1)def
contains
(name)def
count
()def
isEmpty
()def
item
(index)def
length
()def
namedItem
(name)def
namedItemNS
(nsURI, localName)def
removeNamedItem
(name)def
removeNamedItemNS
(nsURI, localName)def
setNamedItem
(newNode)def
setNamedItemNS
(newNode)def
size
()
Detailed Description¶
Note that
QDomNamedNodeMap
does not inherit fromQDomNodeList
. QDomNamedNodeMaps do not provide any specific node ordering. Although nodes in aQDomNamedNodeMap
may be accessed by an ordinal index, this is simply to allow a convenient enumeration of the contents of aQDomNamedNodeMap
, and does not imply that the DOM specifies an ordering of the nodes.The
QDomNamedNodeMap
is used in three places:
entities()
returns a map of all entities described in the DTD.
notations()
returns a map of all notations described in the DTD.
attributes()
returns a map of all attributes of an element.Items in the map are identified by the name which QDomNode::name() returns. Nodes are retrieved using
namedItem()
,namedItemNS()
oritem()
. New nodes are inserted withsetNamedItem()
orsetNamedItemNS()
and removed withremoveNamedItem()
orremoveNamedItemNS()
. Usecontains()
to see if an item with the given name is in the named node map. The number of items is returned bylength()
.Terminology: in this class we use “item” and “node” interchangeably.
- class PySide2.QtXml.QDomNamedNodeMap¶
PySide2.QtXml.QDomNamedNodeMap(arg__1)
- param arg__1:
Constructs an empty named node map.
- PySide2.QtXml.QDomNamedNodeMap.contains(name)¶
- Parameters:
name – str
- Return type:
bool
Returns
true
if the map contains a node calledname
; otherwise returnsfalse
.Note
This function does not take the presence of namespaces into account. Use
namedItemNS()
to test whether the map contains a node with a specific namespace URI and name.
- PySide2.QtXml.QDomNamedNodeMap.count()¶
- Return type:
int
This function is provided for Qt API consistency. It is equivalent to
length()
.
- PySide2.QtXml.QDomNamedNodeMap.isEmpty()¶
- Return type:
bool
Returns
true
if the map is empty; otherwise returnsfalse
. This function is provided for Qt API consistency.
- PySide2.QtXml.QDomNamedNodeMap.item(index)¶
- Parameters:
index – int
- Return type:
Retrieves the node at position
index
.This can be used to iterate over the map. Note that the nodes in the map are ordered arbitrarily.
See also
- PySide2.QtXml.QDomNamedNodeMap.length()¶
- Return type:
int
Returns the number of nodes in the map.
See also
- PySide2.QtXml.QDomNamedNodeMap.namedItem(name)¶
- Parameters:
name – str
- Return type:
Returns the node called
name
.If the named node map does not contain such a node, a
null node
is returned. A node’s name is the name returned bynodeName()
.See also
- PySide2.QtXml.QDomNamedNodeMap.namedItemNS(nsURI, localName)¶
- Parameters:
nsURI – str
localName – str
- Return type:
Returns the node associated with the local name
localName
and the namespace URInsURI
.If the map does not contain such a node, a
null node
is returned.See also
- PySide2.QtXml.QDomNamedNodeMap.__ne__(arg__1)¶
- Parameters:
arg__1 –
PySide2.QtXml.QDomNamedNodeMap
- Return type:
bool
Returns
true
ifn
and this named node map are not equal; otherwise returnsfalse
.
- PySide2.QtXml.QDomNamedNodeMap.__eq__(arg__1)¶
- Parameters:
arg__1 –
PySide2.QtXml.QDomNamedNodeMap
- Return type:
bool
Returns
true
ifn
and this named node map are equal; otherwise returnsfalse
.
- PySide2.QtXml.QDomNamedNodeMap.removeNamedItem(name)¶
- Parameters:
name – str
- Return type:
Removes the node called
name
from the map.The function returns the removed node or a
null node
if the map did not contain a node calledname
.See also
- PySide2.QtXml.QDomNamedNodeMap.removeNamedItemNS(nsURI, localName)¶
- Parameters:
nsURI – str
localName – str
- Return type:
Removes the node with the local name
localName
and the namespace URInsURI
from the map.The function returns the removed node or a
null node
if the map did not contain a node with the local namelocalName
and the namespace URInsURI
.
- PySide2.QtXml.QDomNamedNodeMap.setNamedItem(newNode)¶
- Parameters:
newNode –
PySide2.QtXml.QDomNode
- Return type:
Inserts the node
newNode
into the named node map. The name used by the map is the node name ofnewNode
as returned bynodeName()
.If the new node replaces an existing node, i.e. the map contains a node with the same name, the replaced node is returned.
See also
- PySide2.QtXml.QDomNamedNodeMap.setNamedItemNS(newNode)¶
- Parameters:
newNode –
PySide2.QtXml.QDomNode
- Return type:
Inserts the node
newNode
in the map. If a node with the same namespace URI and the same local name already exists in the map, it is replaced bynewNode
. If the new node replaces an existing node, the replaced node is returned.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.