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);

posted on 2011-09-23 15:18  史琳  阅读(379)  评论(0编辑  收藏  举报

导航