I want to parse the following xml which is the response from an restful webservice:
<ns2:list xmlns="urn:foo1:foo" xmlns:ns2="foo2:foo">
<entityData>
<namedAttributes>...</namedAttributes>
<dynamicEnums>...</dynamicEnums>
</entityData>
<ns2:employees>
<ns2:user id="test">
<ns2:name genderTitle="0" firstName="Rock" surName="Solid"></ns2:name>
</ns2:user >
</ns2:employees>
</ns2:list>
If I try a xpath-expression I only get [object Object] as alert:
function parse(xml){
var test= $(this).find('/ns2:list/ns2:employees/ns2:user[85]/ns2:name');
alert(test);
};
Adding .text()-method like: var test= $(this).find('/ns2:list/ns2:employees/ns2:user[85]/ns2:name').text(); only makes the alert empty...
The xpath expression should not be wrong, I used Firebug to get the expression, maybe in this example some typing error.
Anyone knows whats wrong? Or the other way round: how to alert fields like firstName?