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 » U++ Library support » U++ Core » Xmlize works only for storing
Xmlize works only for storing [message #18445] Wed, 01 October 2008 15:16 Go to previous message
exhu is currently offline  exhu
Messages: 12
Registered: April 2008
Location: Belarus
Promising Member
Please, help understanding the XML serialization implemented in UPP.

This code perfectly saves the XML as intended, but does not load attribute values:
void ServData::save() {
    StoreAsXMLFile(*this);
}

void ServData::load() {
    LoadFromXMLFile(*this);
}

void ServData::Xmlize(XmlIO xml) {
    ::Xmlize(xml.Add("map"), locationMap);
}

/////////


void Xmlize(XmlIO xml, Map & locMap) {
    
    Xmlize(xml.Add("left"), locMap.left);    
    Xmlize(xml.Add("right"), locMap.right);
    Xmlize(xml.Add("top"), locMap.top);
    Xmlize(xml.Add("bottom"), locMap.bottom);
}

void Xmlize(XmlIO xml, MapPlace & place) {
    String nm;
    
	if (xml.IsStoring())
		nm = place.name;
    
    
    xml.Attr("name", nm); // nm is always empty on xml.IsLoading! why?
     
 	if (xml.IsLoading())
 		place.name = nm;
	
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: FindFile, get dir list
Next Topic: String reverse find
Goto Forum:
  


Current Time: Mon May 13 03:59:24 CEST 2024

Total time taken to generate the page: 0.02411 seconds