Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: loadXML() parse error 1072896760

From: Martin Honnen <mahotrash@-----.-->
To: 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent