OpenXml开发 一个应用Xml的例子
3private XmlDocument xmlDoc;
4 //load xml file
5 private void LoadXml()
6 {
7 xmlDoc=new XmlDocument();
8 xmlDoc.Load("User.xml");
9 }
10 //添加节点
11 private void AddElement()
12 {
13 LoadXml();
14 XmlNode xmldocSelect=xmlDoc.SelectSingleNode("user");
15 XmlElement el=xmlDoc.CreateElement("person"); //添加person节点
16 el.SetAttribute("name","风云"); //添加person节点的属性"name"
17 el.SetAttribute("sex","女"); //添加person节点的属性 "sex"
18 el.SetAttribute("age","25"); //添加person节点的属性 "age"
19 XmlElement&n
相关文档:
XML现在已经成为一种通用的数据交换格式,它的平台无关性,语言无关性,系统无关性,给数据集成与交互带来了极大的方便。对于XML本身的语法知识与技术细节,需要阅读相关的技术文献,这里面包括的内容有DOM(Document Object Model),DTD(Document Type Definition),SAX(Simple API for XML),XSD(Xml Schema Definition),XSLT(Exten ......
声明
/// <summary>
/// XML文档
/// </summary>
XmlDocument xmldoc;
&n ......
xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<mobile-list>
<mobile type="Nokia2652">
<wap2>false</wap2>
<width>115</width>
</mobile>
<mobile type="Nokia2650">
......
<%
'
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET","http://127.0.0.1/1.xml",False
http.send
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
'xml.load (Server.MapPath("1.xml")) '如果不是远程文件直接这一步
xml.Load(http.ResponseXML)
Dim t ......