Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

XML and the DOM/Javascript

I would like to query an XML file (see part of the file below), using an input box on a html form, I woud like to type the name of the country eg Albania, and have all the attributes relvant to that country appear on the same form. I have tried using the getElementsByTagName method, but dont know the syntax that will allow me to associate the name of the country with the input box on the form..can someone please help....

<country id="cid-cia-Albania" continent="Europe" name="Albania" datacode="AL" total_area="28750" population="3249136" population_growth="1.34" infant_mortality="49.2" gdp_agri="55" inflation="16" gdp_total="4100" indep_date="28 11 1912" government="emerging democracy" capital="Tirane">
<ethnicgroups name="Greeks">3</ethnicgroups>
<ethnicgroups name="Albanian">95</ethnicgroups>
<religions name="Muslim">70</religions>
<religions name="Roman Catholic">10</religions>
<religions name="Albanian Orthodox">20</religions>
<borders country="cid-cia-Greece">282</borders>
<borders country="cid-cia-Macedonia">151</borders>
<borders country="cid-cia-Serbia-and-Montenegro">287</borders>
<coasts>Adriatic Sea</coasts>
<coasts>Ionian Sea</coasts>
<coasts>Serbia</coasts>
<coasts>Montenegro</coasts>
</country>

thanks
Jack210
[1471 byte] By [Jack210] at [2007-11-11 10:05:38]