wxWidgets中使用wxXmlDocument修改结点属性
wxXmlDocument doc;
if (!doc.Load(filename,"UTF-8", wxXMLDOC_KEEP_WHITESPACE_NODES))
return;
wxXmlNode* root=doc.GetRoot();
if (root->GetName().Lower() != "root")
return;
wxXmlAttribute* attr=root->GetAttributes();
while(attr)
{
if(attr->GetName()=="node1")
{
attr->SetValue(“hello”);
}
attr=attr->GetNext();
}
doc.Save(filename, wxXML_NO_INDENTATION);