jason.lucey@gmail.com wrote:[color=blue]
> Hi,
>
> I need some help figuring this out. I cannot get the xmlhttprequest
> object to return responseXML or getAllResponseHeaders. responseText
> works fine, but i'd rather use xPath than regular expressions to
> populate some tables.
>
> I'm using the XMLHttpRequest object for Mozilla and the
> ActiveXObject("Msxml2.XMLHTTP") for IE.
>
> Here is the javascript
:
>
> //script to load the xml doc using xmlhttprequest or xmlhttp
> if(xDoc) {
> xDoc.open("GET",url,false);
> xDoc.setRequestHeader("Content-Type","text/xml");
>
> if(window.ActiveXObject){
> xDoc.send("");
> } else {
> xDoc.send(null);
> }
>
> if (xDoc.readyState==4) {
> alert(xDoc.responseText); //works fine
> var xHead;
> xHead = xDoc.getAllResponseHeaders();
> alert(xHead); //returns null
> xDoc = xDoc.responseXML.xml;
> alert(xDoc.length); //returns 0
> } else {
> alert("Error--readyState: " + xDoc.readyState);
> }
> }[/color]
I'm guessing these are just code fragments, as xDoc.readyState would
probably not make it to 4 in time to get to the part that //works .
(xDoc.onreadystatechange)
I'm staring at this waiting for something to jump out at me , but
I'm leaning towards the thought that there may be more to this problem
than what we can see here
I myself have already made this journey, and the result was that
I created a little library jsXMLlib.js that merged the functionality
of XMLDOM and XMLHTTP into a little javascript class. Declaring a new
connection goes like this new DCxml(yourURL,yourCallbackFunction)
and as a bonus , I can open many connections at the same time.
Perhaps if you had a sample URL , where we could see what your trying to
do in it's totality.
--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML, CSS,Javascript
--=<>
http://resume.drclue.net <>=-- AJAX, SOAP, XML, HTTP
--=<>
http://www.drclue.net <>=-- SERVLETS,TCP/IP, SQL
--.