New Question on Simple XML DOM Problem in AJAX Implementation

D

dondraper

I have an application that uses a popular but simple set of JavaScript
routines that implement an AJAX call used to populate a drop-down. It
works for thousands of user but I have one customer where it does not
work. It was working but quit over the weekend. I suspect their XML DOM
was either changed, removed or disabled somehow. My assumptions are
that the XMLHTTPRequest object used by the browser to make the http
request is different from the object that is used to parse the XML once
it is returned to the client (XML DOM?).

My question is how can they reinstall the XML DOM and are my
assumptions correct. They are on IE 5.5 and 6.0 under XP SP2. Here is
why I suspect the XML DOM...

After debugging, we verified the XMLHTTP object is working and getting
back our simple XML (verified by displaying the XML from the
http.responseText in an alert window).

var xmlDocument = http.responseXML; <--- pretty sure this works

However, when we parse the incoming XML, the nodelist in their browser
returns 0 elements.

var nodelist = xmlDocument.getElementsByTagName('user'); <---
nodelist is empty??
alert(nodelist.length) <--- this is returning 0 and our list box is
empty after completion.

Any idea why the XMLHTTPRequest can make the http call and get back the
XML but the as we parse it fails. We are sure the <user> tags are in
the XML and this is verified even this client when we displayed the XML
as text using responseText to view it.

Does this line....

var xmlDocument = http.responseXML;

....create an XML DOM object and if yes, it is using a different object
that the XMLHTTPRequest object. Is there anyway my customer can
reinstall something to get this functionality working again? How to
check version? Any advise would be appreciated.

TIA
 
M

Martin Honnen

dondraper wrote:

After debugging, we verified the XMLHTTP object is working and getting
back our simple XML (verified by displaying the XML from the
http.responseText in an alert window).

var xmlDocument = http.responseXML; <--- pretty sure this works

However, when we parse the incoming XML, the nodelist in their browser
returns 0 elements.

var nodelist = xmlDocument.getElementsByTagName('user'); <---
nodelist is empty??

Check
xmlDocument.parseError.reason
xmlDocument.parseError.errorCode
and other properties of the parseError object documented here
<http://msdn.microsoft.com/library/d...html/fdc6ff87-3cfb-4aa0-8bb6-d8c1acf9684e.asp>
to find out whether there might be simply a parse error.

Also check
http.status
http.statusText
http.getAllResponseHeaders()
to find out details about the particular response so that we can check
what might go wrong?
Has the response been sent with Content-Type text/xml or application/xml?

And then show us the XML sent, does it use any namespaces for instance?
 
D

dondraper

Martin,

Great advice. We are sending it as text/xml. No special namespaces and
they are getting the XML in perfect form like everyone else.

We added xmlDocument.parseError.reason and other error attributes to a
test page and checked them right when the xmlDocument was created and
on the very next line where we create the nodelist object. We also
checked that the http.status was 200 and outputted the raw XML so we
could see (using responseText()) that it was all there. We finally
tested this code by sending back compromised XML and it the error
checking displayed the problem in great detail.

Unfortunately, when the customer calls the page, no errors are detected
and nodelist.length still comes back as 0. Not sure what has happened
to their machines but it appears the code is not going to give us a
clue.

Since we are desparate here, we are asking them to:
- reinstall IE 6.0 SP1
- next, reinstall the XMLDOM Core Services

If that does not help, we are writing alternate pages that will encode
our simple data into an delimited string and then parse it out using
raw JavaScript. This will get this one customer back up and running and
then if once proven, we will probably use this for all others. It will
still be doing an AJAX call but not need the XML DOM to parse.

Will post any new information here if we find it. Thanks so much for
your assistance as it would have surely caught any problems when the
xmlDocument object was created.

-Don
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top