Here is my code..
function getAnswer(answerUrl)
{
$.ajax({
type : 'GET',
url : answerUrl,
async: false,
cache: false,
dataType: 'xml',
autoencode: true,
success : function(data)
{
xml_answer = data;
var xml_str = new XMLSerializer().serializeToString(xml_answer.documentElement);
xml_answer= xml_str.replace(/<(/?)([^:>s]*:)?([^>]+)>/g, "<$1$3>");
}
So basically this returns every instance of the data. But I want to filter the data as to only get whatever contains "name=foo." Here is an example of the XML.
<TheoryNames xmlns:ns2="http://www.theory.com/namespace/xxx" xmlns:ns3="http://www.theory.org/LLC/des/xx" xmlns:ns4="http://www.theory.com/num/intelligence/work/llc/xx" name="foo" description="foo description" status="positive">
<date>1.2.3</date>
</TheoryNames>
This is obviously repeated over and over in the XML file and the data differs.
Aucun commentaire:
Enregistrer un commentaire