以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 XML源码及示例(仅原创和转载) 』  (http://bbs.xml.org.cn/list.asp?boardid=32)
----  怎么用msxml2.domdocument读取节点的内容(刚学,勿笑)  (http://bbs.xml.org.cn/dispbbs.asp?boardid=32&rootid=&id=18866)


--  作者:whatsxml
--  发布时间:5/26/2005 3:59:00 PM

--  怎么用msxml2.domdocument读取节点的内容(刚学,勿笑)
比如我现在要获取http://www.xxx.com/aaa.xml中的xml信息,它的xml数据结构如下:
<person>
   <MyName>阿三</MyName>
</person>

我现在就只要获取节点MyName中的内容”阿三“,我参考着网上的一些代码来写,但是又不行的,请大家帮帮忙,感激!!
代码如下:
<%
xmlURL="http://www.xxx.com/aaa.xml"
   set xmlDom=server.CreateObject("MSXML2.DOMDocument")
       xmlDom.async=false
       xmlDom.load(xmlURL)
   set nodeObj=xmlDom.getElementsByTagName("*")    
       for i=0 to nodeObj.length
           If nodeObj.item(i).nodename="MyName" then
               response.Write objLst.item(i).text
           end if    
       next
%>


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
33.203ms