Why when I use the following with Response.Write xmlHTTP.ResponseXML, I get a 500 error "XML Parsing Error: syntax error"
<%
set xmlHTTP = Server.CreateObject("MSXML2.XMLHTTP.3.0")
xmlHTTP.open "Get", "http://www.w3schools.com/xml/note.xml", false
xmlHTTP.send()
Response.ContentType = "text/xml"
Response.Write xmlHTTP.ResponseXML
set xmlHTTP = Nothing
%>
While when I use Response.Write xmlHTTP.ResponseText as in the following all is fine. Isn't the response from the request to the URL XML? If not then in what situation would one use ResponseXML? Example if possible would be helpful.
<%
set xmlHTTP = Server.CreateObject("MSXML2.XMLHTTP.3.0")
xmlHTTP.open "Get", "http://www.w3schools.com/xml/note.xml", false
xmlHTTP.send()
Response.ContentType = "text/xml"
Response.Write xmlHTTP.ResponseText
set xmlHTTP = Nothing
%>
I'd read the documentation.
Remarks
The property is read-only. For security reasons, the parser validation features are always turned off to prevent Microsoft® XML Core Services (MSXML) from attempting to download a document type definition (DTD) or XML-Data definition. If the response entity body is not valid XML, this property returns DOMDocument that was parsed so that you can access the error. This property does not return IXMLDOMParseError itself, but it is accessible from DOMDocument.
If the response was generated by an Active Server Pages (ASP) page and the Multipurpose Internet Mail Extension (MIME) type was not correctly set to one of the supported MIME types using the ASP method Response.ContentType then responseXML will be empty.
The supported MIME types for MSXML 6.0 are: "text/xml", "application/xml" or anything that ends with "+xml", for example "application/rss+xml".
The supported MIME types for versions prior to MSXML 6.0 are: "text/xml", "application/xml".
Note you are using Ver 3. Try 6.
There was another comment here earlier that you really should read. Just pointing out that you are using version 3 and MIME types are limited. Also, see if these other objects work.
PS the results are for Vista
C:\Users>reg query hkcr /f xmlhttp
HKEY_CLASSES_ROOT\Microsoft.XMLHTTP
HKEY_CLASSES_ROOT\Microsoft.XMLHTTP.1.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.3.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.4.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.5.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.6.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.3.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.4.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.5.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.6.0
End of search: 12 match(es) found.
Also be aware there is a limit on how many times you can call any particular XMLHTTP object before a lockout occurs. If that happens (and it does when debugging code), just change to a different XMLHTTP object