I've got an xml file, and I am working on this QDomNodeList :
<a uid="30000206">
<a id="03" label="7016" file="7016.igm"/>
<a id="04" label="7039" file="7039.igm"/>
<a id="05" label="8016" file="8016.igm"/>
<a id="06" label="1019" file="1019.igm"/>
<a id="07" label="3004" file="3004.igm"/>
<a id="08" label="9016" file="9016.igm"/>
</a >
I would like to retrieve the value of each "label" and each "file", contained inside the child nodes.
I don't know how to get exactly the attributes value. To start, I tried this, but I'm totally lost with all the QDom class.
void VGCCC::showInMyTextBox(QDomNodeList myNodeList)
{
for(int i=0; i<myNodeList.count();i++)
{
QDomAttr attributes = myNodeList.at(i).attributes();
QDomNamedNodeMap a = attributes.namedItem("Label").toText();
m_testTextEdit->insertPlainText(a.c_str());
}
}
I just want to retrieve and show each attributes value inside my m_testTextEdit QTextEdit. Can you help me to do my function ?
Try to get attributes this way:
QDomElement elem = myNodeList.at(i).toElement();
QString label = elem.attribute( "label" );
QString file = elem.attribute( "file" );