Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

http request

Status
Not open for further replies.

amiw

Programmer
Apr 1, 2003
113
GB
heres the xml file i am getting using http request object
<?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; ?>
<RESULTS>
<RC>34</RC>
<O>1</O>
<S>5</S>
<SITE I=&quot;1&quot;>
<SITE I=&quot;2&quot;>
<SITE I=&quot;3&quot;>
<SITE I=&quot;4&quot;>
<SITE I=&quot;5&quot;>
</RESULTS>

heres my code

Set xml = Server.CreateObject (&quot;Microsoft.XMLHTTP&quot;)
xml.Open &quot;GET&quot;, &quot; , false'
xml.send

resultLength = CInt(xml.responseXML.selectNodes(&quot;RESULTS/RC/0/S/SITE&quot;).length)

response.write resultLength

whats wrong with this code?


should it be
resultLength = CInt(xml.responseXML.selectNodes(&quot;RESULTS/SITE&quot;).length)

thanks
 
1. Your XML file is not valid. check it:
It should be something like this:

<?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; ?>
<RESULTS>
<RC>34</RC>
<O>1</O>
<S>5</S>
<SITE I=&quot;1&quot;/>
<SITE I=&quot;2&quot;/>
<SITE I=&quot;3&quot;/>
<SITE I=&quot;4&quot;/>
<SITE I=&quot;5&quot;/>
</RESULTS>

2. Your expression: (&quot;RESULTS/RC/0/S/SITE&quot;) does not return a DOM object.

Solution:
This is what you might have wanted:

XML File:

<?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; ?>
<RESULTS>
<RC>34
<O>1
<S>5
<SITE I=&quot;1&quot;/>
<SITE I=&quot;2&quot;/>
<SITE I=&quot;3&quot;/>
<SITE I=&quot;4&quot;/>
<SITE I=&quot;5&quot;/>
</S>
</O>
</RC>
</RESULTS>

ASP Source Code

<%
Set xml = Server.CreateObject (&quot;Microsoft.XMLHTTP&quot;)
xml.Open &quot;GET&quot;, &quot; false'
xml.send

resultLength = CInt(xml.responseXML.selectNodes(&quot;RESULTS/RC/O/S/SITE&quot;).length)

response.write resultLength
%>



Build web applications faster with a few lines of XML Code using DataML[tm]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top