以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 XML基础 』 (http://bbs.xml.org.cn/list.asp?boardid=1) ---- 菜鸟请教:asp读取xml报错的问题! (http://bbs.xml.org.cn/dispbbs.asp?boardid=1&rootid=&id=43171) |
-- 作者:herrylu -- 发布时间:2/8/2007 10:37:00 AM -- 菜鸟请教:asp读取xml报错的问题! 我的网站原有rss的文件rss.xml。 http://218.244.47.210/catalog/rss.xml 我现在试着作了一个asp页(http://218.244.47.210/catalog/test3.asp)想把rss里的内容都读取出来。但是刚做了个测试页就开始报错(缺少对象: '[object]')。 我的读取代码如下: 请高手致点!
|
-- 作者:nocake -- 发布时间:2/8/2007 3:45:00 PM -- <% Set Source = CreateObject("Msxml2.DOMDocument.6.0") Source.async = false Source.load(Server.MapPath("rss.xml")) Set Root = Source.documentElement set subroot=Root.selectSingleNode("channel") set allitem=subroot.childNodes nodeCount = allitem.length 'response.write "<br/>"&nodeCount&"<br/>" For i=1 to nodeCount-1 set node=allitem.nextNode() response.write node.selectSingleNode("link").text '就是这行报的错! next %> |
-- 作者:Qr -- 发布时间:2/8/2007 6:29:00 PM -- 没有必要用nextNode()。 <% Set Source = CreateObject("Msxml2.DOMDocument.6.0") Source.async = false Source.load(Server.MapPath("rss.xml")) Set Root = Source.documentElement 'set subroot=Root.selectSingleNode("channel") 'set allitem=subroot.childNodes set allitem=Root.selectNodes("//item") nodeCount = allitem.length 'response.write "<br/>"&nodeCount&"<br/>" For i=0 to nodeCount-1 'set node=allitem.nextNode() 'response.write node.selectSingleNode("link").text '就是这行报的错! response.write allitem(i).selectSingleNode("link").text&"<br/>" next %> |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
46.875ms |