[Interest] About qxmlstream

Jason H scorp1us at yahoo.com
Fri Jul 20 05:28:48 CEST 2012



Absolutely true.
<condition data="sunny" />  <-- you need to call elementNode.attribute("data")
<condition>sunny</condition> <-- you can call readNodeText() or elementNode,text()

One is an attribute, the other is a text node of an element node. You need to read up on XML if you do not understand the difference. w3schools.com is a good, quick reference


________________________________
From: "wenjun.jiang at nokia.com" <wenjun.jiang at nokia.com>
To: scorp1us at yahoo.com; song.7.liu at nokia.com; interest at qt-project.org 
Sent: Thursday, July 19, 2012 10:08 PM
Subject: RE: [Interest] About qxmlstream



Hi,

Thanks for the reply!

I tried QXmlStreamReader to parse xml like:
<current_conditions>  
            <condition data="sunny" />  
            <temp_f data="52" />  
            <temp_c data="11" />  
            <humidity data=" 33%" />  
            <icon data="/ig/images/weather/sunny.gif" />  
            <wind_condition data="strong" />  
 </current_conditions>  

By using  readElementText () to read the content of “condition” from <condition data="sunny" />, that will return a null string .
If change the xml as  <condition> “sunny” </condition>, right string will be returned.

Best regards!
-Jiang wenjun

From:ext Jason H [mailto:scorp1us at yahoo.com] 
Sent: Thursday, July 19, 2012 9:21 PM
To: Liu Song.7 (Nokia-MP/Beijing); interest at qt-project.org
Cc: Jiang Wenjun (Nokia-MP/Beijing)
Subject: Re: [Interest] About qxmlstream

I don't know that that is valid XML.

Your options are:
<title>Hello</title>
<title some_attribute_name="Hello"/>

Otherwise what you are dealing with only looks like HTML.
You might run it through a converter.




________________________________

From:"song.7.liu at nokia.com" <song.7.liu at nokia.com>
To: interest at qt-project.org 
Cc: wenjun.jiang at nokia.com 
Sent: Thursday, July 19, 2012 3:56 AM
Subject: [Interest] About qxmlstream

Hi,

Can the Qt XML handle the content as below ?

<titleHello />

Any help is appreciated ;)

Thanks,
Song

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest                



More information about the Interest mailing list