I have a xml file. I want to parse it and get the text in the tags.
For example I want to extract "2.6" from the tag infoModelversion. "echo=hi hello" from the tag ns:description .
My xml file is as shown below.
<ns:workflowInvoked
xmlns:ns="http://airavata.apache.org/schemas/wft/2011/08"
infoModelVersion="2.6">
<ns:notificationSource
ns:serviceID="Workflow1_cbc2c80b_511c_4a5b_9f88_fa789378296b"
ns:experimentID="Workflow1_cbc2c80b-511c-4a5b-9f88-fa789378296b" />
<ns:timestamp>2013-07-26T23:45:37.654+05:30</ns:timestamp>
<ns:description>echo=hi hello</ns:description><ns:annotation />
<ns:initiator ns:serviceID="Workflow1_cbc2c80b_511c_4a5b_9f88_fa789378296b" />
</ns:workflowInvoked>
I was trying to parse it using the following code.
var new_var = $(xml).find("ns:workflowInvoked infoModelVersion").text();
console.log(new_var);
I am not getting proper output. Can anybody point out what mistake I am making?