ASP reads XML document instance code

Source: Internet
Author: User
Tags servervariables

H=getlocationurl ()
H1=split (H, "/")
H=replace (H,H1 (UBound (H1)), "Note.xml")

Set http=server.createobject ("Microsoft.XMLHTTP")
http. Open "Get", H,false

Set xml=server.createobject ("Microsoft.XMLDOM")
Xml. Async=false
Xml. Validateonparse=false
Xml. Load (http. Responsexml)
If XML. Readystate>2 Then
Response.Write (the document is ready to go.) Status: "& XML. ReadyState & "<br>")
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><br>")
Response.Write ("The document is not ready yet.) Status: "& XML. ReadyState & "<br>")
End If
Set http=nothing
Set xml=nothing

Function Getlocationurl ()
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 <> "Then" url = URL & ":" & ServerPort
If querystring <> "" Then url=url& "?" & QueryString
End Function
' <?xml version= ' 1.0 ' encoding= ' gb2312 '?>
<title> Sina </title>
<link> Tutorials </link>
<title> Baidu </title>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.