All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
Asp实现获取xml中的内容_[XML教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/3/20 5:10:52 Browse times: 249 Comment times: 0

Asp实现获取xml中的内容_[XML教程]


Head photo

Go homepage
Upload pictures
Write articles

Asp实现获取xml中的内容_[XML教程] note.xml中的内容





新浪
http://www.sina.com.cn


google
http://www.google.cn


百度
http://www.baidu.com


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(""& title.Item(0).Text &"
")
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
%>





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.