QDomNamedNodeMapclass contains a collection of nodes that can be accessed by name. 更多 …
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
()
注意:
QDomNamedNodeMapdoes not inherit fromQDomNodeList. QDomNamedNodeMaps do not provide any specific node ordering. Although nodes in aQDomNamedNodeMapmay 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.
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()oritem(). New nodes are inserted withsetNamedItem()orsetNamedItemNS()and removed withremoveNamedItem()orremoveNamedItemNS()。使用contains()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.
QDomNamedNodeMap
¶
QDomNamedNodeMap(arg__1)
- param arg__1
Constructs an empty named node map.
PySide2.QtXml.QDomNamedNodeMap.
contains
(
name
)
¶
name – unicode
bool
返回
true
if the map contains a node called
name
;否则返回
false
.
注意
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.
isEmpty
(
)
¶
bool
返回
true
if the map is empty; otherwise returns
false
. This function is provided for Qt API consistency.
PySide2.QtXml.QDomNamedNodeMap.
item
(
index
)
¶
index
–
int
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.
另请参阅
PySide2.QtXml.QDomNamedNodeMap.
length
(
)
¶
int
Returns the number of nodes in the map.
另请参阅
PySide2.QtXml.QDomNamedNodeMap.
namedItem
(
name
)
¶
name – unicode
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 by
nodeName()
.
PySide2.QtXml.QDomNamedNodeMap.
namedItemNS
(
nsURI
,
localName
)
¶
nsURI – unicode
localName – unicode
Returns the node associated with the local name
localName
和名称空间 URI
nsURI
.
If the map does not contain such a node, a
null
node
被返回。
PySide2.QtXml.QDomNamedNodeMap.
__ne__
(
arg__1
)
¶
arg__1
–
QDomNamedNodeMap
bool
返回
true
if
n
and this named node map are not equal; otherwise returns
false
.
PySide2.QtXml.QDomNamedNodeMap.
__eq__
(
arg__1
)
¶
arg__1
–
QDomNamedNodeMap
bool
返回
true
if
n
and this named node map are equal; otherwise returns
false
.
PySide2.QtXml.QDomNamedNodeMap.
removeNamedItem
(
name
)
¶
name – unicode
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 called
name
.
PySide2.QtXml.QDomNamedNodeMap.
removeNamedItemNS
(
nsURI
,
localName
)
¶
nsURI – unicode
localName – unicode
Removes the node with the local name
localName
和名称空间 URI
nsURI
from the map.
The function returns the removed node or a
null
node
if the map did not contain a node with the local name
localName
和名称空间 URI
nsURI
.
PySide2.QtXml.QDomNamedNodeMap.
setNamedItem
(
newNode
)
¶
插入节点
newNode
into the named node map. The name used by the map is the node name of
newNode
as 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.
PySide2.QtXml.QDomNamedNodeMap.
setNamedItemNS
(
newNode
)
¶
插入节点
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 by
newNode
. If the new node replaces an existing node, the replaced node is returned.