[Qt-interest] xml parsing

Sean Harmer sean.harmer at maps-technology.com
Wed Oct 28 16:57:57 CET 2009


Hi,

On Wednesday 28 Oct 2009 14:31:22 Hasnat Raza wrote:
<snip>
> and its output is...
> 
> <session name="sessiondetail" >
> <title name="SESSION_#_TITLE=" >title name</title>
> <type name="SESSION_#_TYPE =" >type name</type>
> </session>
> 
> Now i Want to save these values in another file which name lets suppose
> "prac.txt"
> in as format like
> SESSION_#_TITLE=title name
> SESSION_#_TYPE=type name
> 
> Any one please guide the way....thanks in advance

Do you want to read the xml file back in or just simply write out a plain text 
file from the data that you already have in memory?

For case 1 take a look at QXmlStreamReader or use the DOM classes since you 
seem familiar with those anyway.

For case 2, or when you have read and parsed your xml file just open up a 
QFile and and a QTextStream and write out your data with something like

stream << "SESSION_#_TITLE=" << m_myTitle << endl;
stream << "SESSION_#_TYPE=" << m_myType << endl;

Or am I missing the point of your question?

Sean



More information about the Qt-interest-old mailing list