Results 1 to 6 of 6

Thread: Asp Xml Iteration Problem **Resolved**

Threaded View

  1. #1

    Thread Starter
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935

    Asp Xml Iteration Problem **Resolved**

    hello all,

    Has anyone here tried parsing an xml document from an asp page before??

    The code I have written doesnt have any "errors" persay it just doesnt execute correctly

    this is all dummy code for testing so it looks nasty

    The app has the following

    VB Code:
    1. Private Sub Command1_Click()
    2. Dim xmld As MSXML2.DOMDocument30
    3. Dim xmld2 As MSXML2.XMLHTTP30
    4. Dim mynode
    5. Dim myothernode
    6. Dim rmDoc
    7. Set xmld = New MSXML2.DOMDocument30
    8. Set rmDoc = xmld.createElement("bob")
    9. Set xmld.documentElement = rmDoc
    10. Set mynode = xmld.createNode(NODE_ELEMENT, "Hungry", "")
    11. Set myothernode = xmld.createNode(NODE_TEXT, "Food", "")
    12. myothernode.Text = "Hamburgers yummy"
    13. mynode.appendChild (myothernode)
    14. Set xmld2 = New MSXML2.XMLHTTP30
    15. xmld2.open "POST", "http://escs1/richmastery/secure/xml/put_order.asp?IDGRP=AKL&userCode=miketest&pwd=mik001p", False
    16. xmld2.send xmld
    17. Set strResponse = xmld2.responseXML
    18. Text1.Text = ""
    19. Text1.Text = Text1.Text & xmld2.responseText
    20. Open "C:\Workshop\temp\t.htm" For Output As #1
    21. Print #1, Text1.Text
    22. Close #1
    23. WebBrowser1.Navigate "C:\Workshop\temp\t.htm"
    24. End Sub

    then the asp page grabs it validates it and falls apart at this code here

    VB Code:
    1. Private function parse_xml
    2. Dim strField
    3. Dim strValue
    4. Dim isSuccess
    5. Dim xNode
    6. dim oNode
    7. set oNode = XMLdoc.documentElement
    8. Response.Write ("<got here1>")
    9. For Each xNode In oNode.childNodes 'this line is the line that it excutes but doesnt find any nodes so it skips to end of function
    10.    
    11.     'If xNode.nodeType = NODE_TEXT Then
    12.         Response.Write ("<got here2>")
    13.         strField = xNode.parentNode.nodeName
    14.        
    15.         'If Not IsNull(xNode.nodeValue) Then
    16.            'strValue = xNode.nodeValue
    17.         'Else
    18.             strValue = xNode.Text
    19.         'End If
    20.            
    21.         sortValues strField, strValue
    22.                
    23.     'End If
    24.    
    25.     'If xNode.hasChildNodes Then
    26.         'IterateNodes xNode.childNodes
    27.     'End If
    28.  
    29. Next
    30.  
    31. end function
    32.  
    33. private function sortValues(strField, strValue)
    34. Response.ContentType = "text/HTML"
    35. Response.Write ("<" & strfield & ">")
    36. Response.Write (chr(9) & "<" & strvalue & ">")
    37. Response.Write ("</" & strfield & ">")
    38. end function


    any ideas would be greatly appreciated
    Last edited by rudvs2; Aug 8th, 2002 at 12:44 AM.

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