Hello,
I am trying to load an XML file (done I believe) and then find a node which has a specific attribute. I loaded this XML to an object variable but I am not sure that that is the best way to do this. What I need to do is look through the XML, compare the attribute to a string, if it matches stop the search and store the corresponding attribute value in that node.
Can anyone point me in a direction for this?
Code:
var glossaryObj = {};
$.get(pURL, function(xmlFile)
{
$.ajax({
type: "GET",
url: pURL,
dataType: "text",
success: parseGlossXML
});
});
function parseGlossXML(xml)
{
glossaryObj = xml
$(glossaryObj).find('term').each(function(){
alert($(glossaryObj).filter(":first").attr('def'));
});
}
Code:
<item term="AAA" def="Not the American Automobile Association" rollover="Anti-aircraft Artillery" />
<item term="ABCCC" def="Airborne Battlefield Command and Control Center" />
<item term="ABP" def="Air Battle Plan" />
<item term="AC" def="Active Component" />