有用到先上代码,后面总结相关知识,,,
创建:
- XmlDocumentxmlDoc=newXmlDocument();
- //创建类型声明节点
- XmlNodenode=xmlDoc.CreateXmlDeclaration("1.0","utf-8","");
- xmlDoc.AppendChild(node);
- //创建根节点
- XmlNoderoot=xmlDoc.CreateElement("User");
- xmlDoc.AppendChild(root);
- CreateNode(xmlDoc,root,"name","xuwei");
- "sex","male");
- "age","25");
读取:3种方法
1.XmlDocument
2.XmlTextReader
3.linq to xml
原文链接:/xml/293722.html