New Question on Simple XML DOM Problem in AJAX Implementation

Discussion in 'XML' started by dondraper, Jan 26, 2006.

  1. dondraper

    dondraper Guest

    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
    dondraper, Jan 26, 2006
    #1
    1. Advertising

  2. 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/default.asp?url=/library/en-us/xmlsdk/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?



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jan 27, 2006
    #2
    1. Advertising

  3. dondraper

    dondraper Guest

    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
    dondraper, Jan 27, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    534
  2. minnie
    Replies:
    1
    Views:
    665
    Andrew Thompson
    Dec 13, 2006
  3. Replies:
    3
    Views:
    517
    Stefan Behnel
    Aug 3, 2007
  4. Alan
    Replies:
    6
    Views:
    1,566
  5. Erik Wasser
    Replies:
    5
    Views:
    427
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page