parsing xml with asp/vb issues

admin

Administrator
Staff member
hi this is the xml i'm trying to parse:
<?xml...
<prop xmlns:xsi="http://www.w3.....
<code chainID="RK" companyID="DS" propertyID="1234">
<user username="test" password="test />
</code>
<rates>
<rate start=......
</prop>

code that not working..?..
<%
Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")

xmldoc.async = False

xmldoc.load (Server.MapPath("onRes2.xml"))

'make sure we have the right path to the xml packet
response.write("The path to the xml file is: " & _
Server.MapPath("onRes2.xml") & "<br /><br /><br />")

Code:
If (xmldoc.parseError.errorCode <> 0) Then 
   Response.Write "XML " & strType & " error - " & "<br>" & _
                    "Error Reason: " & xmldoc.parseError.reason & "<br>" & _
                    "Source: " & xmldoc.parseError.srcText & "<br>" & _
                    "Error Line: " & xmldoc.parseError.line & "<br>" & _
                   "Error Position: " & xmldoc.parseError.linepos & "<br>" 
   Response.End 
Else 

strUsername  = xmldoc.SelectSingleNode("/prop/code/user/@username").Value

response.write strUsername

End If

Set objXML = Nothing 
%>
 
Back
Top