Thanks @yuvaram @jsulm @yuvaram . he XML which i have posted here is not in proper format . Since the XML is very big i wanted to post a small snippet of it . Thanks for your help .
@Mathan-M Instead of QDom* you can use the QXmlStreamReader as the document says it is quite faster and memory efficient.
Once you get to the parent node you can just use name and readElementText iteratively.
@Paul-Colby i am opening xml file as you mentioned
first time when i pressed save button it will show
<?xml version='1.0'?>
<xml>
<tag1> </tag1> // two spaces from line edit
</xml>
second time when i presses save button it will show
<?xml version='1.0'?>
<xml>
<tag1/> // some data in lineedit
</xml>
third time when i presses save button it will show
<?xml version='1.0'?>
<xml>
<tag1/> // some data in lineedit
</xml>
i am using Qt 4.8.7, i am opening xml file , see the result
@Wilk it's cool! What about JSON serialization?
I will try to use your library in my project http://forum.qt.io/topic/64999/qt-micro-rest-client-framework-beta
@mrjj I don't know but never thought about it so that's why I did that "odd/botched job" and when you mentioned it was like a "Oh man! why didn't I thought in that before? Its so simple...." hahaha I'll keep it in mind henceforth.
Hi and welcome to devnet,
Your path to test.xml is relative so the file should be beside your executable. Currently your executable is located in a shadow build dir. So for your test you can use an absolute path or copy the file in the shadow build dir.
Hi,
thank you very much, it was a really nice help. (Additionally, my XML file wasn't well formatted, but it's fixed).
But there is one thing that I didn't see, how can I relaize: how can I insert a node into an existing XML file?
Regards,
Norbert
Sorry, I misunderstood your problem. You don't need to keep all the data in-memory, you can read the file update the xml and write it again.
On the other hand, you could also use a simple sqlite database to store your values and generate the xml only when needed.