Xml value editing
I have an xml file, I parse xml in qml and was able to create a list model. Now, I have to change some value for example. I have a device whose parameters are 1. pressure 2 .temperature etc., these data are available to me as an xml file. I parse these data create a list view and in the empty field I want to enter the value of pressure and temperature. Once enter is pressed the value at the background should be updated.
I hope you have understood my problem.
Thanks in advance for your help. Appreciated!!
If you need further details kindly write to me!
Hi, there are some parts of your question I don't fully understand. Could you please clarify each point below?
When the user presses "enter", what do you want to do with the old values? Keep them (show old and new values), or delete them (show new values only)?
When the user presses enter", do you want to update your XML file?
I have a xml file, I need to group the individual xml elements with id. for ex. i have ten elements with id 0 and 1. I need to group elements with id "0" and "1" together.
Secondly, I have to replace old values with my new values and display the new value-
I need not update the xml file since it is read-only.
I hope you got an idea.
[quote author="Julie1986" date="1346324765"]I have a xml file, I need to group the individual xml elements with id. for ex. i have ten elements with id 0 and 1. I need to group elements with id "0" and "1" together.[/quote]Do you mean you have ten '0's and ten '1's...?
[quote author="Julie1986" date="1346324765"]Secondly, I have to replace old values with my new values and display the new value[/quote]The best way is to emit a signal when the user clicks the button. Connect the signal to a slot that (i) removes the old values from your list, and then (ii) adds new values into your list, and then (iii) refreshes/updates your view.
How did you insert the original values into the list view? (show us your code)
no I meant 5 "0"s and 5 "1" i want to grup these 5 together as a first step.
At first I dont have any values, I shall start with grouping of elements first. any idea on how to group them
@ <METHOD Name="123" id=2>
<METHOD Name="456" para=1>
<METHOD Name="789" id=1>
I have this kind of xml file, how to group 123 and 789 onw group one below the other
I actually don't have experience with parsing XML files, but I'll try...
It seems like the easiest way to parse XML data is using QXmlStreamReader: http://qt-project.org/doc/qt-4.8/qxmlstreamreader.html Have a look at the docs.
After that, I think you should read ALL your data into memory first, storing the data in lists-inside-lists. After that, you can sort them based on "id".