3,055
社区成员
发帖
与我相关
我的任务
分享
tinyxml2::XMLNode* copy = node->DeepClone(&docXmlCommand);
//对copy节点进行修改?
CString modelName;//指令模板名称
tinyxml2::XMLDocument docXmlcopy = copy->ToDocument();
XMLElement* elmtRootcopy = docXmlcopy.RootElement();
while (elmtRootcopy)
{
const XMLAttribute * Attr = elmtRootcopy->FirstAttribute();
while (Attr)
{
if ((CString)(Attr->Name()) == "name")
{
modelName = (CString)(Attr->Value());
elmtRootcopy->SetAttribute("name", command_name);
elmtRootcopy->SetAttribute("model_name", modelName);
}
Attr = Attr->Next();
}
}
elmtRoot->InsertEndChild(copy);
docXmlCommand.SaveFile("Command.xml");
tinyxml2::XMLNode* copy = node->DeepClone(&docXmlCommand);
elmtRoot->InsertEndChild(copy);
docXmlCommand.SaveFile("Command.xml");