Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » Using DOM like XML parser
Re: Using DOM like XML parser [message #6481 is a reply to message #6480] Tue, 14 November 2006 02:05 Go to previous messageGo to previous message
zsolt is currently offline  zsolt
Messages: 698
Registered: December 2005
Location: Budapest, Hungary
Contributor
luzr wrote on Tue, 14 November 2006 00:59

But the example is not perfect - you should reimplement Save as well Wink



You are right Smile
void AddressBook::Save()
{
	if(IsEmpty(filename)) {
		SaveAs();
		return;
	}
	XmlNode n;
	XmlNode &ab = n.Add(TAG_ADDRESSBOOK);
	for(int i=0; i < array.GetCount(); i++)
	{
		XmlNode &person = ab.Add(TAG_PERSON);
		person.Add(TAG_NAME).Add().CreateText(array.Get(i, TAG_NAME));
		person.Add(TAG_SURNAME).Add().CreateText(array.Get(i, TAG_SURNAME));
		person.Add(TAG_ADDRESS).Add().CreateText(array.Get(i, TAG_ADDRESS));
		person.Add(TAG_EMAIL).Add().CreateText(array.Get(i, TAG_EMAIL));
	}
	if(!SaveFile(filename, AsXML(n)))
		Exclamation("Error saving the file!");
}

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Groovey
Next Topic: An OpenGL ctrl for Linux / X11
Goto Forum:
  


Current Time: Thu May 23 12:58:22 CEST 2024

Total time taken to generate the page: 0.02055 seconds