NYCPHP Meetup

NYPHP.org

[nycphp-talk] XML(?) problem

Faber Fedor faber at linuxnj.com
Fri Feb 25 16:49:47 EST 2005


I'm attemtping to write a webapp using the XMLHTTPRequest functionality
as described over at
http://www.xml.com/pub/a/2005/02/09/xml-http-request.html .  I'm
assuming someone in here has already done this.  If not, anyone know the
URL for the NY XML group (I saw mention of their existence, but no URL).

My problem is here:

function processReqChange()
{
    // only if req shows "complete"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            // ...processing statements go here...
    alert("getting the response");
      response  = req.responseXML.documentElement;

    alert("So far, so good!");
      method    = response.getElementsByTagName('method')[0].firstChild.data;
    alert("method  = " + method);
<snip>

I successfully get to "getting the response" alert but it fails at the
next line.  The Javascript console complains that req.responseXML has no
properties and javascript aborts the function (silently!).
req.statusText says everything's OK and I can even see the text of the
XML in req.responseText.

So I'm guessing the error is that I don't have a wellformed XML
document.  Here is what I have:

<?xml version="1.0"?>
<response>
    <method>refreshQ</method>
    <result>My Results!</result>
</response>

which, to me, is well-formed.

I googled for everything I can think of and came up with nada.  Any
suggestions?




-- 
 
Regards,
 
Faber                     

Linux New Jersey: Open Source Solutions for New Jersey
http://www.linuxnj.com






More information about the talk mailing list