Tirupati Balan
Tirupati Balan

Reputation: 674

how to convert Xmlstring to Xmlfile or QDomDocument

If I have a string which contains proper xml format and I want to convert it to an XML file so I can use Xpath to parse it properly.

How do I do this? please give me some valid example and i also want to load those each xml node value into Qtablewidgetitem how can i do..please help mee

Upvotes: 1

Views: 676

Answers (2)

liaK
liaK

Reputation: 11648

I have a string which contains proper xml format and I want to convert it to an XML file

This requires a normal file writing which saved under the extension .xml. Check out the example given for file writing in the QFile for Qt 4.6.

i also want to load those each xml node value

For this you require QDomDocument, QDomElement etc., to retrieve the values and the nodes stored in the XML file.

Check out the examples given for QDomDocument documentation.

Hope it helps.

Upvotes: 2

Stephen Chu
Stephen Chu

Reputation: 12832

There are several QDomDocument::setContent calls you can use to load data to a QDomDocument. The same document also lists an example: http://doc.qt.io/archives/4.6/itemviews-simpledommodel.html

Upvotes: 0

Related Questions