473,804 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

responseXML in Internet Explorer

I'm having trouble figuring out what's going on with IE6's
Msxml2.XMLHTTP object. I have two feed addresses in this stripped down
version of my code below. Both work fine in Firefox (using the
XMLHttpRequest object), but only the thinkgeek one works in IE. In the
processFeed function, it shows the problem - the first alert shows 0
for the wikihow feed in IE, though it can still display the
responseText. Any insight?
//var feedAddr = "http://www.thinkgeek.c om/thinkgeek.rss"; <<< works
fine in both
var feedAddr = "http://www.wikihow.com/feed.rss"; <<< only works in
FF

var url = "http://.../getXML.asp?url= " + feedAddr; <<< returns XML w/
content type text/xml
loadXMLDoc(url) ;

function loadXMLDoc(url)
{
var req;
if(window.XMLHt tpRequest)
{
try { req = new XMLHttpRequest( ); }
catch(e) { req = false; }
}
else if(window.Activ eXObject)
{
try { req = new ActiveXObject(" Msxml2.XMLHTTP" ); }
catch(e)
{
try { req = new ActiveXObject(" Microsoft.XMLHT TP"); }
catch(e) { req = false; }
}
}
if(req)
{
req.onreadystat echange = function(){ processReqChang e(req); };
req.open("GET", url, true);
req.send("");
}
else { XMLObjError(); }
}
function processReqChang e(req)
{
if (req.readyState == 4)
{
if (req.status == 200) { processFeed(req ); }
else { XMLReqError(); }
}
}
function processFeed(req )
{
var xmlDoc = req.responseXML ;
alert(xmlDoc.ch ildNodes.length ); <<< shows 0 in IE for the wikihow
feed
alert(req.respo nseText);

//... do stuff
}

Aug 18 '06 #1
6 4271


wi**********@ho tmail.com wrote:
I'm having trouble figuring out what's going on with IE6's
Msxml2.XMLHTTP object. I have two feed addresses in this stripped down
version of my code below. Both work fine in Firefox (using the
XMLHttpRequest object), but only the thinkgeek one works in IE. In the
processFeed function, it shows the problem - the first alert shows 0
for the wikihow feed in IE, though it can still display the
responseText. Any insight?
//var feedAddr = "http://www.thinkgeek.c om/thinkgeek.rss"; <<< works
fine in both
var feedAddr = "http://www.wikihow.com/feed.rss"; <<< only works in
FF

var url = "http://.../getXML.asp?url= " + feedAddr; <<< returns XML w/
content type text/xml
loadXMLDoc(url) ;
So in terms of the client side code you do not make a request to the URL
http://www.wikihow.com/feed.rss but rather to some different server that
then fetches the URL? Then look into that getXML.asp code and whether it
returns anything different.
Things to check on the client:

req.getAllRespo nseHeaders()
req.responseXML .parseError.err orCode
req.responseXML .parseError.rea son

Show us the response headers you get. Or post the URL of that getXML.asp
script so that we can check what it returns.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 18 '06 #2

Martin Honnen wrote:
So in terms of the client side code you do not make a request to the URL
http://www.wikihow.com/feed.rss but rather to some different server that
then fetches the URL?
Yes, as far as I know, from the client side you can only make a request
to the same server as the page (that's the only way I could get it to
work anyway).
The asp script is only on my local server at the moment, so here's the
code:
function loadXML(byval xmlAddress)
dim xmlDoc

'Load the XML
set xmlDoc = CreateObject("M icrosoft.XMLDOM ")
xmlDoc.async = false
xmlDoc.setPrope rty "ServerHTTPRequ est", true
on error resume next
xmlDoc.load(xml Address)
if err 0 then
set loadXML = null
exit function
end if
set loadXML = xmlDoc
end function
dim x
dim address
dim content
address = request.QuerySt ring("url")
if address <"" then
set x = loadXML(address )
if isnull(x) or x.xml = "" then
response.Status = "404 Not Found"
response.End()
else
content = x.xml
end if
end if
response.Conten tType = "text/xml"
response.Write( content)

Then look into that getXML.asp code and whether it
returns anything different.
The getXML.asp returns the same thing as going to the feed url
directly.
Things to check on the client:

req.getAllRespo nseHeaders()
req.responseXML .parseError.err orCode
req.responseXML .parseError.rea son

Show us the response headers you get. Or post the URL of that getXML.asp
script so that we can check what it returns.
Here's what it returns in IE for the wikihow feed:
X-Powered-By: ASP.NET Content-Length: 6996 Content-Type: text/xml

-1072896760

An invalid character was found in text content.
I have no idea what this means...

Thanks for your help Martin.

Aug 18 '06 #3


wi**********@ho tmail.com wrote:

set x = loadXML(address )
if isnull(x) or x.xml = "" then
response.Status = "404 Not Found"
response.End()
else
content = x.xml
end if
end if
response.Conten tType = "text/xml"
response.Write( content)
Don't do that response.Write( content), instead simply do
x.save Response
if you want to send the loaded XML to the browser.
-1072896760

An invalid character was found in text content.
That means that MSXML in IE can't parse the XML your ASP returns as it
is not able to decode the bytes to characters, caused by changes in the
character encoding that probably occur due to your ASP page writing out
text in a certain code page that is different from the encoding the XML
doccument declares in its XML declaration. I hope my suggested change to
your ASP script fixes that problem.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 18 '06 #4

Martin Honnen wrote:
Don't do that response.Write( content), instead simply do
x.save Response
if you want to send the loaded XML to the browser.
-1072896760

An invalid character was found in text content.

That means that MSXML in IE can't parse the XML your ASP returns as it
is not able to decode the bytes to characters, caused by changes in the
character encoding that probably occur due to your ASP page writing out
text in a certain code page that is different from the encoding the XML
doccument declares in its XML declaration. I hope my suggested change to
your ASP script fixes that problem.
Thanks for the explanation. That change didn't have any effect,
however.

Aug 18 '06 #5


wi**********@ho tmail.com wrote:

That change didn't have any effect,
however.
It is an ASP problem not a JavaScript problem. One way with MSXML and
ASP to grab another URL and send it to the client unchanged could be
alike (very rough outline, no error checking)

Set HttpRequest = CreateObject("M sxml2.ServerXML HTTP.3.0")
HttpRequest.ope n "GET", Request.QuerySt ring("url"), False
HttpRequest.sen d

If HttpRequest.sta tus = 200 Then
Response.Conten tType = HttpRequest.get ResponseHeader( "Content-Type")
Response.Binary Write HttpRequest.res ponseBody
End

I hope those lines help, if not consider asking in a Microsoft group on
ASP or XML (e.g. microsoft.publi c.xml).

Or use J(ava)Script in ASP :), then we could deal with it here without
getting off topic.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 18 '06 #6
Your first suggestion DID work! I just had to close IE and open it
again 'cause it wasn't refreshing - sheesh!

Thanks!

Aug 18 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2680
by: Raymond H. | last post by:
Hello, I create a vb4 project which can also naviger on Internet via the WebBrowser control which I put on my form. My question is: if this program is installed on a station having already Internet Explorer in it then will it cause an error if version Internet Explorer is the same one as WebBrowser which is in my project? Is it this control which Internet Explorer uses? If that can cause errors of version then, instead, can I install this...
3
8585
by: Alexander Mikhailian | last post by:
I have an http = new XMLHttpRequest(); that provides me with an http.responseXML. Somewhere deep in the http.responseXML there is a fragment called e.g. mydom that I want to copy with all its children to the document. document.getElementsByTagName('body').innerHTML=mydom; does not work. What should I do? Traverse mydom manually? Look for a JS library that does this already?
2
2297
by: CathieC | last post by:
I have a websote developed using visual studio 2005 beta , .net version 2 i deploy my application to a server and it is run from client computers. One of the users gets the error "Internet Explorer cannot open the internet site "XXXXX" Operation aborted" this happens when they click on a menu item to open a page. they do not get
3
2356
by: VK | last post by:
Internet Explorer 7 beta 2 preview CNET Editor review: <http://reviews.cnet.com/Internet_Explorer_7_for_XP_SP2_Beta_2/4505-3514_7-31454661-2.html?tag=nl.e415> Summary (my personal review interpretation): "Half stolen from Firefox, half is buggy - including the stolen part". Download: <http://www.download.com/Internet-Explorer-7/3000-2356_4-10497433.html?tag=nl.e415>
11
11628
by: Wendy | last post by:
Hello, I have a program that does the following: When a user clicks on a row in a VB.NET datagrid, it will open a web page in Internet Explorer (that corresponds to that item in the selected row in the datagrid). It will automatically print that web page, and then it will close the Internet Explorer window. I have code that works perfectly when a regular web page is opened, however when a pdf web page is opened the printing never...
14
6078
by: webEater | last post by:
I downloaded IE7 and tried out the native XMLHttpRequest support. I think there is an object in IE7 called "XMLHttpRequest" but I ask me why it is called "XML"HttpRequest. I made a request to an XML file (correctly sent with text/xml header) but IE7 returns the same shit as IE 5.5/6 when I use responseXML, an XML construct with a node "xml", which contains nothing. Firefox and Opera and Netscape 7.1 (yeah,) do it correctly. What's goin...
3
11500
by: laredotornado | last post by:
Hi, This problem only affects PC IE. On a secured page (a page visited via https), there is a link that reads -- "Download HTML File". The link connects to this page <?php require("../../util_fns.php"); session_start();
9
7736
by: Etayki | last post by:
Hi! I am new to VB.net and I am using the Visual Basic 2005 Express Edition I have two questions: 1. I am trying to write an application that will automate Internet Explorer and store data in a database. Am I better off learning VB.net or C#.net? Is there a free development environment for C# as well?
1
2461
by: -Lost | last post by:
This is more of a post to inform, unless of course I am missing something fundamental, in which case I would appreciate anyone explaining it. Based on Mr. Michaux's camelizeStyle function I wrote: function create_style(style) { var p = document.createElement('p'); var t = document.createTextNode('Just something to fill the P.');
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10101
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9177
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.