How to find XML node by attribute, compare to known variable, if it matches get sibling attribute
Hello,
I need help finding an XML node by its attribute. Once I find the correct node I want to retrieve the second attribute in that same node.
Can anyone point me in a direction?
[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]
This is a sample of my XML file, it is not the entire file.
[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" />
[/code]