国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > XML > 正文

asp獲取xml中的內容

2024-09-05 20:55:39
字體:
來源:轉載
供稿:網友
note.xml中的內容
<?xml version="1.0" encoding="gb2312"?>
<channel>
<item>
  <title>新浪</title>
  <link>http://www.sina.com.cn</link>
</item>
<item>
  <title>google</title>
  <link>http://www.google.cn</link>
</item>
<item>
  <title>百度</title>
  <link>http://www.baidu.com</link>
</item>
</channel>

index.asp中的內容
<%
h=GetLocationURL()'獲取當前地址
h1=Split(h,"/")
h=Replace(h,h1(UBound(h1)),"note.xml")

Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET",h,False
http.send

Set xml=Server.CreateObject("Microsoft.XMLDOM")
xml.Async=False
xml.ValidateOnParse=False
xml.Load(http.ResponseXML)
If xml.ReadyState>2 Then
        Response.Write("文檔已經準備就緒。狀態:"& xml.ReadyState &"
")
        Set item=xml.getElementsByTagName("item")
        For i=0 To (item.Length-1)
        Set title=item.Item(i).getElementsByTagName("title")
        Set link=item.Item(i).getElementsByTagName("link")
        Response.Write("<a href="""& link.Item(0).Text &""" target=""_blank"">"& title.Item(0).Text &"</a>
")
        Next
Else
        Response.Write("文檔還未準備就緒。狀態:"& xml.ReadyState &"
")
End If
Set http=Nothing
Set xml=Nothing
%>
<%
Function GetLocationURL() 
Dim Url 
Dim ServerPort,ServerName,ScriptName,QueryString 
ServerName = Request.ServerVariables("SERVER_NAME") 
ServerPort = Request.ServerVariables("SERVER_PORT") 
ScriptName = Request.ServerVariables("SCRIPT_NAME") 
QueryString = Request.ServerVariables("QUERY_STRING") 
Url="http://"&ServerName 
If ServerPort <> "80" Then Url = Url & ":" & ServerPort 
Url=Url&ScriptName 
If QueryString <>"" Then Url=Url&"?"& QueryString 
GetLocationURL=Url 
End Function 
%>
運行index.asp文件
源碼地址:http://www.aspprogram.cn/soft.asp?id=19
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 桦甸市| 南川市| 澳门| 孙吴县| 图片| 湖北省| 光泽县| 渭南市| 嘉祥县| 永川市| 普洱| 砀山县| 东明县| 湘乡市| 西平县| 赤壁市| 修水县| 耿马| 遵化市| 仁布县| 揭东县| 仪陇县| 石渠县| 九龙坡区| 灌云县| 望都县| 泸州市| 襄汾县| 许昌县| 府谷县| 长岛县| 华坪县| 格尔木市| 巴林右旗| 定南县| 吉隆县| 桐乡市| 湄潭县| 西昌市| 石棉县| 昭通市|