Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - loadXML() parse error 1072896760 >Thread Next - Re: loadXML() parse error 1072896760 Re: loadXML() parse error 1072896760To: NULL Date: 10/2/2004 1:40:00 PM
Scott wrote:
>
> Dim sourceUrl, xmlDoc, xmlHttp
> sourceUrl =
> "http://www.somesource.com/search?client=someclient&output=xml_no_dtd&q=computers&num=0&ad=w15&adtest=on&adpage=3&adsafe=high&ip=10.1.4.80&useragent=Mozilla/4.0%20(compatible;%20MSIE%206.0;%20Windows%20NT%205.2;%20.NET%20CLR%201.1.4322)"
>
> Set xmlDoc = Server.CreateObject("MSXML2.DOMDocument.4.0")
> Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.4.0")
>
> xmlHttp.open "GET", sourceUrl, False
> xmlHttp.setRequestHeader "Content-Type", "text/xml"
If you do a HTTP GET request you are not sending any request body thus
you should not send the request header for Content-Type, there is no
content.
> xmlHttp.send()
Setting the Content-Type above would only make sense if here you would
send some XML e.g.
xmlHttp.send("<root><child>Kibo</child></root>")
thus as already said above you shouldn't set the request header for
Content-Type.
> Response.Write xmlHttp.responseText & "<br><br><br>" & chr(13) & chr(10)
>
> xmlDoc.validateOnParse = false
>
> xmlDoc.loadXML(xmlHttp.responseText)
There is no need to parse responseXML, you can simply use
xmlHttp.responseXML
as that is automatically created. And if you parse responseText you
might run into encoding related problems which do not occur if you
simply use responseXML, a Msxml2.DOMDocument object.
--
Martin Honnen
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
