XML and ASP: Retrieve and parse a remote file

后端 未结 6 1437
长情又很酷
长情又很酷 2021-01-05 22:31

I\'m building a site on a Windows Server with ASP enabled. I need to retrieve an XML document from another server and return a value in that document. The xml file is small

6条回答
  •  执笔经年
    2021-01-05 23:25

    I wrote this function:

    <%
       Option Explicit
       Response.Buffer = True
       Dim xml
       Set xml = Server.CreateObject("Microsoft.XMLDOM")
       xml.async = False
       xml.setProperty "ServerHTTPRequest", True
       xml.Load ("http://www.midominio.com/nombre.xml")
       Dim title, heading, paragraph, testHTML
       title = xml.documentElement.childNodes(0).text
       heading = xml.documentElement.childNodes(1).text
       paragraph = xml.documentElement.childNodes(2).text
       testHTML = xml.documentElement.childNodes(3).text
       Set xml = Nothing
    %>
    
       
       <%= title %>
       
       
       

    <%= heading %>

    <% = paragraph %>

    <%= testHTML %>

提交回复
热议问题