hello
is it possible to get all attributes for a particular node in pyqt ?
for example .. consider for following node:
< asset Name="3dAsset" ID="5"/>
i want to retrieve the ("Name" and "ID") strings
is it possible?
thanks in advance
hello
is it possible to get all attributes for a particular node in pyqt ?
for example .. consider for following node:
< asset Name="3dAsset" ID="5"/>
i want to retrieve the ("Name" and "ID") strings
is it possible?
thanks in advance
You can retrieve the particular value of the attribute using the function,
QString QDomElement::attribute ( const QString & name, const QString & defValue = QString() ) const
To get all the attributes use,
QDomNamedNodeMap QDomElement::attributes () const
and you have to traverse through the DomNamedNodeMap and get the value of each of the attributes. Hope it helps.
Edit : Try this one.
With the QDomNamedNodeMap you are having give,
QDomNode QDomNamedNodeMap::item ( int index ) const
which will return a QDomNode for the particular attribute. Then give,
QDomAttr QDomNode::toAttr () const
With the QDomAttr obtained give,
QString name () const
which will return the name of the attribute. Hope it helps.