||10-10-2012 07:49 PM
How to find a term in an XML file
I am trying to load an XML file (no problems yet) and then, when a user enter some text into an input TF and hits enter, I want to look for that entered text in the XML file and return information associated with that text.
Do I have to itterate through the entire XML file with '.find'? I have to use attr() in there somewhere, than when it matches I need to return the 'def' attribute.
<item term="AAA" def="Not the American Automobile Association" rollover="A is A and A" />
<item term="ABC" def="Alpha Beta Carl" />
<item term="ABP" def="Air Bypass" />
<item term="AC" def="Air Conditioner" />
/* This captures the ENTER key event and checks for letters and numbers only. */
var glossary_file = $.get('glossary/glossary_data.xml');
if (event.keyCode == 13)
var letterNumber = /^[0-9a-zA-Z]+$/;
// when the stringEntered is found how do I
//glossary_file = $.parseXML( stringEntered );
||10-10-2012 08:25 PM
I don't really know how jQuery parses xml. If they were normal html tags you could do this:
|All times are GMT +1. The time now is 04:09 AM.
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.