如何操作一个XML,使用wxWidgets ?
可以使用一下方法:
wxXmlDocument doc; wxString str_filename =file; if(false == doc.Load(str_filename)) { return; } wxXmlNode* root = doc.GetRoot(); wxXmlNode* child_root = root->GetChildren(); while(child_root) { if (child_root->GetName() == "NAME0" ) { wxXmlNode *node_navMap_child = child_root->GetChildren(); while(NULL != node_navMap_child) { if (node_navMap_child->GetName() == "NAME1" ) { child_root->RemoveChild(node_navMap_child);//test OK } node_navMap_child = child_root->GetChildren(); } } child_root= child_root->GetNext(); } doc.Save(str_filename);
测试OK!
原文链接:https://www.f2er.com/xml/299165.html