Jquery parse xml with name spaces

Jquery parse xml with name spaces

I am trying to get two values from a web service response.

The web service was called using jquery $ajax:

         $.ajax({
            url : "http://localhost:3032/ufs/integration/copymoveTerm",
            type : "POST",
            dataType : "xml",
            data : soapEnv,
            success : undoSuccess,
            failure : showError,
            contentType : "text/xml; charset=\"utf - 8\""
         }); // end move AJAX call


And this is the response I get:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<res:Response xmlns:res="http://www.ebasetech.com/LADRA_COPYMOVE_TERM_OP/Response">
<res:OUTPUT>
<res:UNDO_COUNT>1.0</res:UNDO_COUNT>
<res:MSG>Undo complete (No more to undo)</res:MSG>
</res:OUTPUT>
</res:Response>
<res:OUTPUT xmlns:res="http://www.ebasetech.com/LADRA_COPYMOVE_TERM_OP/Response"/>
</soap:Body>
</soap:Envelope>



All I want to do is to get the values of UNDO_COUNT and MSG into separate variables.

Here is the jquery I am trying to use:

function undoSuccess(xmlData, status, xmlResponse)
{
    $(xmlResponse).find('res:OUTPUT').each(function () {
        var undoCount = $(this).attr('res:UNDO_COUNT).text();
        var msg = $(this).attr('res:MSG).text();
    });
}

I have tried it with and without the name space "res:".
I have tried it with xmlData and with xmlResponse
I have tried changing the web service so that UNDO_COUNT and MSG were elements in their own right or were attributes of OUTPUT  all without success it just bypasses the initial find on OUTPUT.

Any pointers please, I just don't see where I'm going wrong

Thanks

IanBram