I have an XML data structure being returned from my server on an AJAX
call (excerpt here):

    <SOAP-ENV:Envelope>
    -
        <SOAP-ENV:Body>
    -
        <idc:service IdcService="CHECKIN_UNIVERSAL">
    -
        <idc:document dDocType="Reports" dUser="jim" dIsCheckedOut="0"
dRevisionID="1" dCreateDate="10/12/09 1:12 PM"
dDocName="AGR_REPT_FINAL" dDocAuthor="jim" dOutDate=""
dCheckoutUser="" dPublishState="" dInDate="10/12/09 1:12 PM"
dReleaseState="N" dRevClassID="4721" dDocTitle="AGR FINAL REPORT"
dProcessingState="Y" dRevLabel="2" dID="9151">
        <idc:field name="StatusMessage">
Content item 'AGR_REPT_FINAL' was not successfully checked in. The
content item is not currently checked out.
    </idc:field>
    <idc:field
name="StatusReason">csIsNotCheckedOutError:DARS_REPT_COM_AGR</
idc:field>
    <idc:field name="StatusCode">-1</idc:field>
    </idc:document>
    </idc:service>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>


I have eliminated a lot of extraneous '<idc:field name="foo">bar</
idc:field>' entries in my post, otherwise it is the server output. The
three fields I need are the ones I've kept. I am trying to read them
via:

    success:       function(data)
    {
      if(!out.innerHTML || typeof(out.innerHTML) != "string")
      {
        out.innerHTML = "";
      }
      var jqxml = $( data );
      //0 on success, else failure
      var jqStatusCode = jqxml.find("idc:field [name =
'StatusCode']");
      var jqStatusReason = jqxml.find("idc:field [name =
'StatusReason']");
      var jqStatusMessage = jqxml.find("idc:field [name =
'StatusMessage']");
      //print the type of each, followed by the text in parenthesis
      out.innerHTML += "<HR><SPAN CLASS=\"statusnote\">Response Text("
+ data + "):</SPAN><BR>";
      out.innerHTML += "<TABLE><TR><TD>" + jqStatusCode + ":(" +
jqStatusCode.text() + ")</TD><TD>" +
                                           jqStatusReason + ":(" +
jqStatusReason.text() + ")</TD><TD>" +
                                           jqStatusMessage + ":(" +
jqStatusMessage.text() + ")</TD></TR></TABLE>";
      out.innerHTML += "<HR SIZE=2>";
      //Nothing prints out for this section
      jqxml.find("idc:field").each(function(Index)
      {
        out.innerHTML+="idc:field Index: " + Index + ": " + $( this )
[ 0 ].nodeName ;
      });
      out.innerHTML += "<HR SIZE=2>";
      //this section prints out a lot of stuff, however if I print out
tmp[o], I end up getting redirected to my server,
      //with a parameter string of "about:blank"
      tmp = jqStatusCode;
      out.innerHTML+="Looking at: " + tmp + "<BR>";
      for(o in tmp)
      {
        out.innerHTML+="<BR><B>data." + o + "</B>: (" + typeof(tmp[o]) + "):
";
      }
    }
  };
  // bind form using 'ajaxForm'
  $('#ReportUploadForm').ajaxForm(options);
});



Unfortunately, the text() on each value of interest returns an empty
string. I suspect my problem is either (a) the XML is confusing the
interpreter (wouldn't that throw an error?) or a more likely (b) I'm
doing something wrong. However, looking through the documentation and
exploring the values returned, I can't figure out what it is.

Any suggestions?
Thanks,
-Jim

Reply via email to