如何用asp加载直接显示xml呢
时间:2007-04-16
来源:互联网
但加载现实就是单纯的文字了,怎么在把他现实成xml文档啊。
代码如下:book.xml
<?xml version="1.0" encoding="gb2312" ?>
<booklist>
<book isbn="1231">
<title>0AJAX高级程序设计</title>
<author>AJAX是一本不错的书,大家都可以去看看</author>
<publisher>wrox</publisher>
</book>
</booklist>
xuanze.asp页面:
<%option explicit%>
<%
dim objxml,i
set objxml=server.createobject("microsoft.xmldom")
objxml.async=false
objxml.load(server.mappath("book.xml"))
Response.ContentType="text/xml"
Response.CharSet = "gb2312"
Response.Write("<?xml version=""1.0"" encoding=""gb2312""?>")
response.write "<booklist>"
response.write"<book>"
response.write "<title>"&objxml.childnodes(1).childnodes(0).childnodes(0).text&"</title>"
response.write "<author>"&objxml.childnodes(1).childnodes(0).childnodes(1).text&"</author>"
response.write "<publisher>"&objxml.childnodes(1).childnodes(0).childnodes(2).text&"</publisher>"
response.write "</book>"
response.write "</booklist>"
%>
有没有好的方法啊,直接加载xml,直接现实,而不要在在写一编代码啊。
作者: yanjinbin 发布时间: 2007-04-16
作者: mumu0726 发布时间: 2007-04-16
可不可以?
作者: PaulLeder 发布时间: 2007-04-16
Response.Write("<?xml version=""1.0"" encoding=""gb2312""?>")
response.write "<booklist>"
response.write"<book>"
response.write "<title>"&objxml.childnodes(1).childnodes(0).childnodes(0).text&"</title>"
response.write "<author>"&objxml.childnodes(1).childnodes(0).childnodes(1).text&"</author>"
response.write "<publisher>"&objxml.childnodes(1).childnodes(0).childnodes(2).text&"</publisher>"
response.write "</book>"
response.write "</booklist>"
而是直接加载xml能直接显示出来而不用上面那段代码。
有人知道这个问题因该怎么解决吗?
作者: yanjinbin 发布时间: 2007-04-16
来个高人来帮忙搞定下啊
作者: yanjinbin 发布时间: 2007-04-16
如这样:
<%
dim objxml,i
set objxml=server.createobject("microsoft.xmldom")
objxml.async=false
objxml.load(server.mappath("book.xml"))
Response.ContentType="text/xml"
Response.CharSet = "gb2312"
response.write objxml.childnodes(1).childnodes(0).childnodes(2)
%>
然后就把该节点的xml显示出来啊,
这里显示的是错误。
作者: yanjinbin 发布时间: 2007-04-16
作者: mop2004 发布时间: 2007-05-21
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28