xml文档中添加结点(结帖率100%,在线等!!!)

我有xml文档,内容为

1<booklist>
2<book category="ASP">
3<isbn>1861003382</isbn>
4<title>Beginning Active Server Pages 3.0</title>
5</book>
6
7</booklist>

我需要在其中添加结点(不通过数据库),例如:

1<booklist>
2<book category="ASP">
3<isbn>1861003382</isbn>
4<image/>此处为二进制数据//此结点是我想添加的   
5<title>Beginning Active Server Pages 3.0</title>
6</book>
7
8</booklist>

此结点的二进制数据应该如何添加(也许说的不是很明白);
我想要的就是带有二进制数的xml文件。

谢谢!!
---------------------------------------------------------------

我想你应该把XML解析成DOM然后在DOM中添加吧.
(DOM文档操作和XML文件互相转换的java实现
http://www.5xsoft.com/data/200110/1908135901.htm)

我就懂这么一点点.帮你顶.
---------------------------------------------------------------

 1   
 2  
 3Set objStream = Server.CreateObject("ADODB.Stream")   
 4objStream.Type = 1   
 5objStream.Open   
 6objStream.LoadFromFile Server.MapPath("01.pdf")   
 7  
 8  
 9  
10'添加XML节点   
11dim xmldoc,node   
12set xmldoc=server.CreateObject("msxml2.domdocument")   
13xmldoc.async=false   
14  
15xmldoc.load server.MapPath("test.xml")   
16  
17set node=xmldoc.createElement("image")   
18node.dataType="bin.base64"   
19node.nodeTypedValue=objStream.Read   
20xmldoc.selectSingleNode("//Book").appendChild node   
21'xmldoc.save server.MapPath("test.xml")   
22  
23Response.Write xmldoc.xml   
24  
Published At
Categories with Web编程
comments powered by Disqus