求助,ASP读取 XML 文件的方法

求助,ASP读取 XML 文件的方法

求助,ASP读取 XML 文件的方法

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xmlnssd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetCancellationFeeResponse xmlns="http://touric.com/webservices/">

<GetCancellationFeeResult>
<CancellationFeeValue>0</CancellationFeeValue>
<Currency>USD</Currency>

</GetCancellationFeeResult>
</GetCancellationFeeResponse>
</soap:Body></soap:Envelope>

我要读取节点 CancellationFeeValue 、Currency 的值 0、USD

该怎么写呀!!

谢谢
 

回复:求助,ASP读取 XML 文件的方法

设上面的XML文件的名为xmlname.xml
则ASP文件的内容为:
<%
strSourceFile = Server.MapPath("xmlname.xml")
Set objXML =Server.CreateObject("Microsoft.XMLDOM")  '创建一个XML对像
objXML.load(strSourceFile)  '把XML文件读入内存     
Set xml=objXML.documentElement.selectSingleNode("GetCancellationFeeResult")  '选取节点 GetCancellationFeeResult   
item1=xml.childNodes.item(0).text  '将0传给item1
item2=xml.childNodes.item(1).text  '将USD传给item2
Set xml=nothing
Set objXML =nothing
%>
一个人活着就一定要有一个人活着的理由.
 
1  /  1  页   1 跳转

版权所有 riachina.com   Sitemap

Powered by Discuz!NT 2.1.202    Copyright © 2001-2008 Comsenz Inc.
Processed in 0 second(s) (Cached).
返顶部