-
February 10th, 2009, 06:30 AM
#1
Loading and Saving XML files
Hi there,
Kindly help me with the loading and saving features of XML files using TinyXml.
Your help is appreciated.
-
February 10th, 2009, 11:11 PM
#2
Re: Loading and Saving XML files
Have you taken a look at the tutorial here?
http://www.grinninglizard.com/tinyxm...tutorial0.html
It shows examples of loading an XML file using tinyXML. If this code, or code like it is not working, could you please explain the problem you are having and the code you are trying?
-
February 11th, 2009, 12:33 AM
#3
Re: Loading and Saving XML files
yup! i have gone through the tutorial but it is using the xml nodes inside the coding which i dont want. I have a GUI where i can load the contents from an Xml. I want to read the specified parameters and if any change done on the GUI, i want to reflect those changes into the same xml or maybe creating a new xml file which is a replica of the original one and saving the changes in it.
-
February 11th, 2009, 12:59 AM
#4
Re: Loading and Saving XML files
You're going to have to give more information to get answers... Show us the code you've tried, tell us how it isn't working, etc...
-
February 11th, 2009, 01:50 AM
#5
Re: Loading and Saving XML files
Thanks for the prompt reply. I have to write a code in Native C++ using which i have to load the contents of an XML into GUI and write back the changes done (pertaining to parameters) into another xml which is a replica of the loaded XML. The usage of TinyXml is a must. I am new to C++ programming. I have done the same thing ample no. of times in C# but have no clue how to do the same in Native C++ using TinyXml. The code in TinyXml tutorial shows the load and save feature but using the parameters within the code whereas i have to change them at run-time using the GUI. Please help. Its kind-a- urgent. Thankyou.
-
February 11th, 2009, 09:06 AM
#6
Re: Loading and Saving XML files
It sounds like your question may be more of a GUI one than a TinyXml one. You are going to have to change parameters "in code", you just have to do so when the user changes something about the GUI.
Say your XML was structured something like
Code:
<mainwindow>
<dialogbox>
<button1 width="10" height="20"/>
</dialogbox>
</mainwindow>
In your program when the user modified the width or height of that button1, you would use code along then lines of
Code:
int newWidth, newHeight; // values the user has changed
TiXmlDocument myDoc; // your menu XML file
TiXmlHandle docHandle(&myDoc);
TiXmlElement* buttonElem = docHandle.FirstChild("mainwindow").FirstChild("dialogbox").FirstChild("button1");
if (buttonElem)
{
buttonElem->SetAttribute("width", newWidth);
buttonElem->SetAttribute("height", newHeight);
}
else
// error, button1 does not exist in the document
If you need more specific answers about the GUI, you will have to find someone familiar with the particular GUI library you're using... you can ask here, but you may be better off seeing if there is a forum dedicated to that library where you can get faster answers.
-
February 12th, 2009, 07:06 AM
#7
Re: Loading and Saving XML files
thanks for the reply. The contents from the GUI will be received in a map or vector form.
I have to create a replica of the original xml and the data that i have got in the map/vector has to be updated in the fields accordingly. The map will conatin all the values, even the one which have not been changed. So in a way, i have to override all the child values, but since i dont have the names of the labels used in GUI, i have to consider the 1st value as the value of first child and so on. Can you kindly help me in the same.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|