Results 1 to 3 of 3

Thread: ASP & XML

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345

    ASP & XML

    Hi!

    I have XML coming through a URL. I need to parse that XML.

    I am using XMLHTTP (on the server side) to get the data. That piece is working fine.
    I need help in parsing the data, which could be through XSLT or DOM or anything. Please help.

    Following is my code.


    Code:
    Response.Buffer = True
      Dim objXMLHTTP, xml
    
      ' Create an xmlhttp object:
      Set xml = Server.CreateObject("Microsoft.XMLHTTP")
      ' Or, for version 3.0 of XMLHTTP, use:
      ' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
    
      ' Opens the connection to the remote server.
      xml.Open "GET", "http://xyz.com", False
    	
      ' Actually Sends the request and returns the data:
      xml.Send
    
      'Display the HTML both as HTML and as text
      Response.Write "<h1>The HTML text</h1><xmp>"
      Response.Write xml.responseText
      Response.Write "</xmp><p><hr><p><h1>The HTML Output</h1>"
    
      Response.Write xml.responseText
     
      
      Set xml = Nothing
    
    
    
    
    Set xmlRoot = xml.documentElement
    
    For Each xmlPNode In xmlRoot.childNodes
            xml = xml & _
             "<H3>" & xmlPNode.nodeName & "</H3>"
            If xmlPNode.childNodes.length = 0 Then
                    strDoc = strDoc & _
                     "<I>No data</I>"
            Else
                    strDoc = strDoc & "<TABLE border>"
                    For Each xmlNode In xmlPNode.childNodes
                             strDoc = strDoc & "<TR>" & _
                              "<TD><B>" & xmlNode.nodeName & ":</B></TD>" & _
                              "<TD>" & xmlNode.text + "</TD>" & _
                              "</TR>"
                    Next
            End If
            strDoc = strDoc & "</TABLE>"
    Next   
    Response.Write strDoc
    Thanks.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: ASP & XML

    See my reply in your other thread, try keeping your questions to a single thread so as to avoid anarchy.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345

    Re: ASP & XML

    Thanks
    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width