I have tried with QDocDocument and I am always getting values as 1.4.1.2011.4.1.201?
QList< QMap<QString,QString> > Package;
/* QDomDocument takes any QIODevice. as well as QString buffer*/
if (!doc.setContent(xmlFile))
{
return;
}
//Get the root element
// you could check the root tag name here if it matters
QString rootTag
= docElem.
tagName();
// == package
// get the node's interested in, this time only caring about person's
QDomNodeList nodeList
= docElem.
elementsByTagName("folder");
//Check each node one by one.
for(int ii = 0;ii < nodeList.count(); ii++)
{
QMap<QString, QString> firmwarefolder;
// get the current one as QDomElement
firmwarefolder["folder"] = el.attribute("folder"); // get and set the attribute ID
firmwarefolder["file"] = el.attribute("file");
//get all data for the element, by looping through all child elements
while(!pEntries.isNull()) {
if(tagNam == "folder") { /* We've found first name. */
firmwarefolder["file"] = el.text();
}else if(tagNam == "file") { /* We've found surname. */
firmwarefolder["file"] = peData.text();
}
pEntries = pEntries.nextSibling();
}
Package.append(firmwarefolder);
}
QList< QMap<QString,QString> > Package;
/* QDomDocument takes any QIODevice. as well as QString buffer*/
QDomDocument doc("mydocument");
if (!doc.setContent(xmlFile))
{
return;
}
//Get the root element
QDomElement docElem = doc.documentElement();
// you could check the root tag name here if it matters
QString rootTag = docElem.tagName(); // == package
QString fll = docElem.text();
// get the node's interested in, this time only caring about person's
QDomNodeList nodeList = docElem.elementsByTagName("folder");
//Check each node one by one.
for(int ii = 0;ii < nodeList.count(); ii++)
{
QMap<QString, QString> firmwarefolder;
// get the current one as QDomElement
QDomElement el = nodeList.at(ii).toElement();
firmwarefolder["folder"] = el.attribute("folder"); // get and set the attribute ID
firmwarefolder["file"] = el.attribute("file");
//get all data for the element, by looping through all child elements
QDomNode pEntries = el.firstChild();
while(!pEntries.isNull()) {
QDomElement peData = pEntries.toElement();
QString tagNam = peData.tagName();
if(tagNam == "folder") { /* We've found first name. */
firmwarefolder["file"] = el.text();
}else if(tagNam == "file") { /* We've found surname. */
firmwarefolder["file"] = peData.text();
}
pEntries = pEntries.nextSibling();
}
Package.append(firmwarefolder);
}
To copy to clipboard, switch view to plain text mode
I have added these codes. But am not getting the folder name and file name.. Whats wrong with this?
Bookmarks