IE7 native xmlHTTP's responseXML

J

jackchang1

hi,

I am having trouble accessing responseXML of the XMLHttpRequest object
by using native xmlHTTP support in IE7. I am requesting a XML from
server, however, the response header from the sever I got is not
"application/xml" but "application/octet-stream", and this has caused
the problem for me to access the responseXML. In addition, I can't
override the content type since overrideMimeType method is not
supported in IE7. Does anybody has this knowledge for this issue? The
last thing I have to do is to switch back to ActiveX control in IE7.
Thank you for your input!

Regards,
 
B

Bart Van der Donck

I am having trouble accessing responseXML of the XMLHttpRequest object
by using native xmlHTTP support in IE7. I am requesting a XML from
server, however, the response header from the sever I got is not
"application/xml" but "application/octet-stream", and this has caused
the problem for me to access the responseXML. In addition, I can't
override the content type since overrideMimeType method is not
supported in IE7. Does anybody has this knowledge for this issue?

If you're running the Apache web server, try to add a file called
'.htaccess' in the same directory as the XML-file, with the following
content in it:

AddType application/xml xml

Or, alternatively:

AddType text/xml xml

Hope this helps,
 
J

jackchang1

Thanks Bart!

Unfortunately, I am not the administrator of the server, and I think
it is IIS powered by ASP.NET. I guess I am looking forward to client
workaround solution for IE7.
 
D

David Mark

Thanks Bart!

Unfortunately, I am not the administrator of the server, and I think
it is IIS powered by ASP.NET. I guess I am looking forward to client
workaround solution for IE7.

You are screwed. The responseXML property will not be an XML document
unless the response was served with an XML MIME type (and that does
not include XHTML MIME types.) The overrideMimeType method is a hack
to get around this, but IE doesn't support it.
 
D

David Mark

Thanks Bart!

Unfortunately, I am not the administrator of the server, and I think
it is IIS powered by ASP.NET. I guess I am looking forward to client
workaround solution for IE7.

Actually, come to think of it, if you can use the ActiveX version in
your environment, you can use the overrideMimeType workaround.
 
T

Thomas 'PointedEars' Lahn

David said:
You are screwed.

Not at all.
The responseXML property will not be an XML document unless the response
was served with an XML MIME type (and that does not include XHTML MIME
types.) The overrideMimeType method is a hack to get around this, but IE
doesn't support it.

However, it is possible to parse the value of the `responseText' property
into an XML document object:

http://www.faqts.com/knowledge_base/view.phtml/aid/6826/fid/616

OP: Please don't top-post.
http://www.jibbering.com/faq/faq_notes/clj_posts.html#ps1Post


PointedEars
 
D

David Mark

Not at all.


However, it is possible to parse the value of the `responseText' property
into an XML document object:

That wasn't what was asked.

If you are going to introduce ActiveX into it, you might as well use
the ActiveX version of XHR, which supports overrideMimeType.

As the OP specifically asked about the "native" implementation, I
assume that his environment does not allow the use of ActiveX.
 
J

jackchang1

Not at all.


However, it is possible to parse the value of the `responseText' property
into an XML document object:

http://www.faqts.com/knowledge_base/view.phtml/aid/6826/fid/616
Thanks for the link! As David mentioned, I might use the ActiveX
version of XHR. In addition, from my experience the ActiveX version of
XHR doesn't care whether the content-type is set right.
oops! Sorry for doing the top posting.
 
T

Thomas 'PointedEars' Lahn

Thanks for the link!

You're welcome.
As David mentioned, I might use the ActiveX version of XHR.

It would seem that you misunderstood him. He meant quite correctly that if
one was to use an ActiveX/COM object for parsing the value of the
`responseText' property into an XML document, one could also use the
overrideMimeType() method to make `responseText' available then. (I don't
agree with the conclusion, though; overrideMimeType() is an evil hack
compared to parsing `responseText'.) However, his assumption was that since
you asked specifically about the so-called native (but not native at all)
XHR object, you were in a position where you could not use ActiveX/COM
objects and so you could not follow the aforementioned approach.
In addition, from my experience the ActiveX version of
XHR doesn't care whether the content-type is set right.

You are mistaken, as the above FAQ points out.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,255
Members
46,853
Latest member
GeorgiaSta

Latest Threads

Top