Xml Manipulation
时间:2010-10-02 来源:irischan
在java中,处理XML用jdom挺好用的。
在C#中,有类似的类,而不需要用Navigator:
XmlTextReader reader=new XmlTextReader(FILE_NAME); XmlDocument doc=new XmlDocument(); doc.Load(reader); // 注意Load和LoadXml的区别,后者的参数为Xml片段 reader.Close(); XmlElement root=doc.DocumentElement; XmlNode node=root.SelectSingleNode("//char[@id=1234"); node.Attributes["id"].Value="4321"; doc.Save(FILE_NAME);
相关阅读 更多 +