PDA

View Full Version : Xml



Fastman
23rd July 2007, 09:56
There is a variable szData = new char [qnSize]; which contains XML data accepted from the client. How to transfer it in XML parser?

fullmetalcoder
23rd July 2007, 10:10
There are many ways to achieve that :

Create a QDocument (http://doc.trolltech.com/latest/qdocument.html) and feed it through QDocument::setContent() (http://doc.trolltech.com/latest/qdocument.html#setContent) then you can iterate over the node structure starting from QDomDocument::documentElement()
Create a QXmlInputSource (http://doc.trolltech.com/latest/qxmlinputsource.html), fill it with QXmlInputSource::setData() (http://doc.trolltech.com/latest/qxmlinputsource.html#setData) and pass it to a QXmlReader (http://doc.trolltech.com/latest/qxmlreader.html)
(!needs Qt 4.3!) setup a QXmlStreamReader (http://doc.trolltech.com/latest/qxmlstreamreader.html) and feed it through QXmlStreamReader::addData()... Isn't it amazing to see how much thing you can do with Qt and how many different ways, each suiting a different purpose, are available to do a single task? :)

Fastman
23rd July 2007, 10:28
Isn't it amazing to see how much thing you can do with Qt and how many different ways, each suiting a different purpose, are available to do a single task? :)


Really very beautifully all turns out:) Thanks for advice. QXmlStreamReader:: addData () - really works:)