//--------------------------------------------------------- void CSG_MetaData::_Save(wxXmlNode *pNode) const { int i; //----------------------------------------------------- pNode->SetName (CSG_String(Get_Name().Length() ? Get_Name() : CSG_String("NODE")).c_str()); pNode->SetContent(Get_Content().c_str()); if( Get_Content().Length() > 0 || (Get_Property_Count() == 0 && Get_Children_Count() == 0) ) { wxXmlNode *pChild = new wxXmlNode(pNode, wxXML_TEXT_NODE, SG_T("TEXT")); pChild->SetContent(Get_Content().c_str()); } //----------------------------------------------------- for(i=0; i<Get_Property_Count(); i++) { pNode->AddAttribute(Get_Property_Name(i).c_str(), Get_Property(i)); } //----------------------------------------------------- for(i=Get_Children_Count()-1; i>=0; i--) { Get_Child(i)->_Save(new wxXmlNode(pNode, wxXML_ELEMENT_NODE, Get_Child(i)->Get_Name().c_str())); } }
//--------------------------------------------------------- void CSG_MetaData::_Save(wxXmlNode *pNode) const { int i; pNode->SetName (Get_Name().Length() ? SG_String_To_UTF8(Get_Name()).c_str() : SG_T("NODE")); pNode->SetContent(SG_String_To_UTF8(Get_Content()).c_str()); if( Get_Content().Length() > 0 ) { wxXmlNode *pChild = new wxXmlNode(pNode, wxXML_TEXT_NODE, SG_T("TEXT"));// SG_String_To_UTF8(Get_Name()).c_str()); pChild->SetContent(SG_String_To_UTF8(Get_Content()).c_str()); } //----------------------------------------------------- for(i=0; i<Get_Property_Count(); i++) { pNode->AddProperty(SG_String_To_UTF8(Get_Property_Name(i)).c_str(), SG_String_To_UTF8(Get_Property(i)).c_str()); } //----------------------------------------------------- for(i=Get_Children_Count()-1; i>=0; i--) { if( Get_Child(i)->Get_Content().Length() > 0 || Get_Child(i)->Get_Children_Count() > 0 ) { wxXmlNode *pChild = new wxXmlNode(pNode, wxXML_ELEMENT_NODE, SG_String_To_UTF8(Get_Child(i)->Get_Name()).c_str()); Get_Child(i)->_Save(pChild); } } }