PDA

View Full Version : Retrive values using qt



jeyanthinatarajan
5th July 2012, 08:01
Hi,

How to get the <item id> or <publish node> value from the below text

<message from="pubsub.esprosnet.com" to="jeyanthi@esprosnet.com" id="1010__jeyanthi@esprosnet.com__T97x0">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="1010">
<item id="KSTO1055887203">
<alert xmlns="http://www.incident.com/cap/1.0">
<identifier>KSTO1055887203</identifier>
<sender>KSTO@NWS.NOAA.GOV</sender>
<sent>2003-06-17T14:57:00-07:00</sent>
<status>Actual</status>
<msgType>Alert</msgType>
<scope>Public</scope>
<info>
<category>Met</category>
<event>SEVERE THUNDERSTORM</event>
<urgency>Severe</urgency>
<certainty>Likely</certainty>
<eventCode>same=SVR</eventCode>
<senderName>NATIONAL WEATHER SERVICE SACRAMENTO</senderName>
<headline>SEVERE THUNDERSTORM WARNING</headline>
<description>
AT 254 PM PDT... NATIONAL WEATHER SERVICE DOPPLER RADAR
INDICATED A SEVERE THUNDERSTORM OVER SOUTH CENTRAL ALPINE
COUNTY... OR ABOUT 18 MILES SOUTHEAST OF KIRKWOOD...
MOVING SOUTHWEST AT 5 MPH. HAIL... INTENSE RAIN AND STRONG
DAMAGING WINDS ARE LIKELY WITH THIS STORM
</description>
<instruction>
TAKE COVER IN A SUBSTANTIAL SHELTER UNTIL THE STORM PASSES
</instruction>
<contact>BARUFFALDI/JUSKIE</contact>
<area>
<areaDesc>
EXTREME NORTH CENTRAL TUOLUMNE COUNTY IN CALIFORNIA,
EXTREME NORTHEASTERN CALAVERAS COUNTY IN CALIFORNIA,
SOUTHWESTERN ALPINE COUNTY IN CALIFORNIA
</areaDesc>
<polygon>
38.47,-120.14 38.34,-119.95 38.52,-119.74
38.62,-119.89 38.47,-120.14
</polygon>
<geocode>fips6=006109</geocode>
<geocode>fips6=006109</geocode>
<geocode>fips6=006103</geocode>
</area>
</info>
</alert>
</item>
</items>
</event>
<headers xmlns="http://jabber.org/protocol/shim">
<header name="pubsub#subid">KsTH9R9SKlQkO1fgYpllLv4ED1PeSMeaE2F0sxo3</header>
</headers>
</message>

ChrisW67
5th July 2012, 08:31
Did you look at the Qt docs first? There is a whole module dedicated to XML manipulation, another dedicated to XML queries, and some other classes outside that.

Any of QXmlStreamreader, QDomDocument, QXmlSimpleReader, or QXmlQuery might be useful.