[Qt-interest] Xml parsing

Yuvaraj R yuvaraj at ongobiz.com
Tue Jul 7 11:41:52 CEST 2009


Hi All

My xml file is look like


*<xml><service process="frenzlist">*
*<head>*
*<from>yuvaraj333</from>*
*<to>yuvaraj333</to>*
*<domain>roamieo.com</domain>*
*</head><*
*body><statusCode>200</statusCode>*
*<statusMessage>Success</statusMessage>*

*I am trying to parse as follows*

QDomDocument doc;

doc.setContent(xml1);

QDomElement root =doc.documentElement();

if(root.tagName() != "xml")

{

return;

}

QDomNode node = root.firstChild();

while(!node.isNull())

{

if(node.toElement().tagName() == "head")

{

parseEntry(node.toElement());

}

if(node.toElement().tagName() == "body")

{

parseEntry(node.toElement());

}

if(node.toElement().tagName() == "service")

{

qDebug() <<node.toElement().localName();

parseEntry(node.toElement());

}



*depends upon service process i have to do further..*

**

*..Example*

**

*if(process == "frenzlist")*

*{*

*  // do something*

*}*

*else*

*{*

*   return;*

*}*





Thanks



Yuvaraj R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090707/a468aed8/attachment.html 


More information about the Qt-interest-old mailing list