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 ......
HTML.html文件
<div align="center" class="style1">
<p>冰棍列表</p>
<p></p>
<table width="400" border="1">
<tr>
<th scope="col"><font size="4">品牌</font></th> ......
book_schema.xml文件
<?xml version="1.0" encoding="gb2312"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="丛书">
<xs:complexType>
<xs:sequence>
<xs:element name="书">
&n ......
大量SmipleXML函数可用来加载和解析大量XML文档。
1.simpleXML_load_file()函数来加载指定的XML文件到对象。如果加载文件时遇到问题,则返回FLASE。例:
book.xml文件:
<?xml version="1.0" standalone="yes"?>
<library>
<book>
<title>Pride and Prejudice</title>
< ......
<%
'
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 ......