关于XMLDocument控件。
_di_IXMLDocument xd = NewXMLDocument();
AnsiString str="<?xml version="1.0" encoding="utf-8" ?><StudentInfo></StudentInfo>";
xd->LoadFromXML(str);
_di_IXMLNode root = xd->DocumentElement;
_di_IXMLNode elemstudent = xd->CreateElement("Student","");
elemstudent->SetAttribute("name","luo");
elemstudent->SetAttribute("age","20");
root->ChildNodes->Add(elemstudent);
root->Attributes["path"]="123";
AnsiString file="my.xml" ;
xd->SaveToFile(file);
上面是个简单的程序 ,为什么生成的 XML文件是这样啊
<?xml version="1.0" encoding="utf-8"?>
<StudentInfo path="True"><Student name="True" age="True"/></StudentInfo>
怎么属性值都是True
[解决办法]
你指定的是UTF-8编码.