"John Byrne" <Jo*******@discussions.microsoft.comwrote in message
news:D4**********************************@microsof t.com...
Hi,
I have an Ajax call on my ASP page that calls another ASP which returns a
file which is data in XML format and the file is of content-type of
text/xml.
>
This call works OK when used from IE6 (it uses the ActiveX object) but
something strange is happening under IE7.
Under IE7, the call works OK and I can do an alert(req.responseText) on
the
client side and it displays the data returned in XML format.
But when I try to access the data using responseXML it keeps returning an
empty document. Even doing alert(req.responseXML.childNodes.length)
displays
0, but I know that there is data.
Any ideas as to what is wrong?
I tried running under Firefox and it complains that the <?xml... is not on
the first line - and this is caused by the @Page directive inserting a
blank
line - also any ideas on how to stop the page directive from creating
blank
lines???
Whitespace before the <?xml declare is invalid according to the XML spec.
However earlier implementations of MSXML were more forgiving and simply
ignored it. Later implementations (MSXML3 and above) were more strict
however they continued to keep faith with the earlier implementations when
invoked from CLSIDs and ProgIDs of the older versions.
XMLHttpRequest being a very recent addition to IE7 will stick strictly to
the standards.
ASP has an unfortunate behaviour in this regard:-
<!-- #include virtual="/someinclude.asp" -->
<html>
<body>
...
The CRLF before the <htmltag is included in the response of the inline
content hence extra whitespace at the start.
However something like this:-
<!-- #include virtual="/someinclude.asp" -->
<%
Response.Write "<html>"
%>
<body>
Does not suffer this problem because ASP does not create send the CRLF that
preceeds an inline script.
Frankly any ASP code that sends XML ought to be purely script with no inline
content to be sent at all. Would it be a good guess that this page is not
using an XML DOM to build the XML to be sent?
>
Thanks