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:
Private Sub Command1_Click() Dim xmld As MSXML2.DOMDocument30 Dim xmld2 As MSXML2.XMLHTTP30 Dim mynode Dim myothernode Dim rmDoc Set xmld = New MSXML2.DOMDocument30 Set rmDoc = xmld.createElement("bob") Set xmld.documentElement = rmDoc Set mynode = xmld.createNode(NODE_ELEMENT, "Hungry", "") Set myothernode = xmld.createNode(NODE_TEXT, "Food", "") myothernode.Text = "Hamburgers yummy" mynode.appendChild (myothernode) Set xmld2 = New MSXML2.XMLHTTP30 xmld2.open "POST", "http://escs1/richmastery/secure/xml/put_order.asp?IDGRP=AKL&userCode=miketest&pwd=mik001p", False xmld2.send xmld Set strResponse = xmld2.responseXML Text1.Text = "" Text1.Text = Text1.Text & xmld2.responseText Open "C:\Workshop\temp\t.htm" For Output As #1 Print #1, Text1.Text Close #1 WebBrowser1.Navigate "C:\Workshop\temp\t.htm" End Sub
then the asp page grabs it validates it and falls apart at this code here
VB Code:
Private function parse_xml Dim strField Dim strValue Dim isSuccess Dim xNode dim oNode set oNode = XMLdoc.documentElement Response.Write ("<got here1>") 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 'If xNode.nodeType = NODE_TEXT Then Response.Write ("<got here2>") strField = xNode.parentNode.nodeName 'If Not IsNull(xNode.nodeValue) Then 'strValue = xNode.nodeValue 'Else strValue = xNode.Text 'End If sortValues strField, strValue 'End If 'If xNode.hasChildNodes Then 'IterateNodes xNode.childNodes 'End If Next end function private function sortValues(strField, strValue) Response.ContentType = "text/HTML" Response.Write ("<" & strfield & ">") Response.Write (chr(9) & "<" & strvalue & ">") Response.Write ("</" & strfield & ">") end function
any ideas would be greatly appreciated




Reply With Quote