PySide6.QtXml.QDomNamedNodeMap¶
- class QDomNamedNodeMap¶
- The - QDomNamedNodeMapclass contains a collection of nodes that can be accessed by name. More…- Synopsis¶- Methods¶- def - __init__()
- def - contains()
- def - count()
- def - isEmpty()
- def - item()
- def - length()
- def - namedItem()
- def - namedItemNS()
- def - __ne__()
- def - __eq__()
- def - setNamedItem()
- def - setNamedItemNS()
- def - size()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- Note that - QDomNamedNodeMapdoes not inherit from- QDomNodeList. QDomNamedNodeMaps do not provide any specific node ordering. Although nodes in a- QDomNamedNodeMapmay be accessed by an ordinal index, this is simply to allow a convenient enumeration of the contents of a- QDomNamedNodeMap, and does not imply that the DOM specifies an ordering of the nodes.- The - QDomNamedNodeMapis 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()or- item(). New nodes are inserted with- setNamedItem()or- setNamedItemNS()and removed with- removeNamedItem()or- removeNamedItemNS(). Use- contains()to see if an item with the given name is in the named node map. The number of items is returned by- length().- Terminology: in this class we use “item” and “node” interchangeably. - __init__()¶
 - Constructs an empty named node map. - __init__(namedNodeMap)
- Parameters:
- namedNodeMap – - QDomNamedNodeMap
 
 - Constructs a copy of - namedNodeMap.- contains(name)¶
- Parameters:
- name – str 
- Return type:
- bool 
 
 - Returns - trueif the map contains a node called- name; otherwise returns- false.- 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.- count()¶
- Return type:
- int 
 
 - This function is provided for Qt API consistency. It is equivalent to - length().- isEmpty()¶
- Return type:
- bool 
 
 - Returns - trueif the map is empty; otherwise returns- false. This function is provided for Qt API consistency.- 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 - length()¶
- Return type:
- int 
 
 - Returns the number of nodes in the map. - See also - Returns the node called - name.- If the named node map does not contain such a node, a - null nodeis returned. A node’s name is the name returned by- nodeName().- See also - Returns the node associated with the local name - localNameand the namespace URI- nsURI.- If the map does not contain such a node, a - null nodeis returned.- See also - __ne__(other)¶
- Parameters:
- other – - QDomNamedNodeMap
- Return type:
- bool 
 
 - Returns - trueif- otherand this named node map are not equal; otherwise returns- false.- __eq__(other)¶
- Parameters:
- other – - QDomNamedNodeMap
- Return type:
- bool 
 
 - Returns - trueif- otherand this named node map are equal; otherwise returns- false.- Removes the node called - namefrom the map.- The function returns the removed node or a - null nodeif the map did not contain a node called- name.- See also - Removes the node with the local name - localNameand the namespace URI- nsURIfrom the map.- The function returns the removed node or a - null nodeif the map did not contain a node with the local name- localNameand the namespace URI- nsURI.- Inserts the node - newNodeinto the named node map. The name used by the map is the node name of- newNodeas returned by- nodeName().- 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 - Inserts the node - newNodein the map. If a node with the same namespace URI and the same local name already exists in the map, it is replaced by- newNode. If the new node replaces an existing node, the replaced node is returned.- size()¶
- Return type:
- int 
 
 - This function is provided for Qt API consistency. It is equivalent to - length().