views:

34

answers:

0

Hi, I am using Jquery. I have an xml returned from a webservice. So I want to extract some value from it.

This is an xml example returned from webservice:

    <ns3:ExecuteResponse xmlns:ns3="http://www.opengis.net/wps/1.0.0" xmlns:ns1="http://www.opengis.net/ows/1.1" xmlns:ns2="http://www.w3.org/1999/xlink" statusLocation="http://webservice:9090/b57c-43b8-40b2-8e09-4d6489df55be" serviceInstance="http://xyz.it:9090/services/http-post" version="1.0.0" service="XXX">
<ns3:Process ns3:processVersion="0.2">
<ns1:Identifier>OM_BIOCLIM</ns1:Identifier>
<ns1:Title xml:lang="en-US">Bioclim</ns1:Title>
<ns1:Abstract xml:lang="en-US">abcdefghi</ns1:Abstract>
</ns3:Process>
<ns3:Status creationTime="2010-07-07T10:42:05.768+02:00">
<ns3:ProcessAccepted>ProcessConfiguration has been accepted.</ns3:ProcessAccepted>
</ns3:Status>
<ns3:ProcessOutputs />
</ns3:ExecuteResponse>

So this is my code:

    $.ajax({
      type: 'POST',
      url: "php/geoproxy.php?url=http://www.abc.it:9090/1.0.0-service/services/http-post",//wpsUrl,
          contentType: "text/xml",
      data: xmlRequest,
      dataType: "text/xml",
      success: function(xml){

        var xmlDoc;                             
        if (window.DOMParser)
          {
          parser=new DOMParser();
          xmlDoc=parser.parseFromString(xml,"text/xml");
          }
        else // Internet Explorer
          {
          xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
          xmlDoc.async="false";
          xmlDoc.loadXML(xml);
          } 

            //extract statusLocation attribute
        },
    error: function(XMLHttpRequest, textStatus, errorThrown) { 
      alert("error "+XMLHttpRequest); 
    } 
});

How I can extract the statusLocation attribute of ns3:ExecuteResponse node?

Thanks a lot.