check the element value in xml file

Anenlyvensusy

New Member
this is my xml:-\[code\]<results> <result> <Country_Code>IN</Country_Code> <Country_Name>India</Country_Name> <Region_Name>Gujarat</Region_Name> <City>Rajkot</City> <lat>13.060422</lat> <lng>80.24958300000003</lng> </result> <result> <Country_Code>KE</Country_Code> <Country_Name>Kenya</Country_Name> <Region_Name>Vihiga</Region_Name> <City>Kakamega</City> <lat>0.1182473</lat> <lng>34.7334515999997</lng> </result></results>\[/code\]this is script:-\[code\]<script> var xml; $.get( "sea.xml", null, function (data) { xml = data; }, "xml" ); function get_list(ls) { var elName = $('#select').val(); var value = http://stackoverflow.com/questions/15541506/$('#value').val(); var xPath = '//lat[@value '+ ls +' "'+elName+'"]'and var xPathh='//lng[@value '+ ls +' '+value+']'+'/../City/@value'; var xPath = '//[lat = ('+ elName+') and lng = ('+ value +')]'+'/result'; var iterator = xml.evaluate(xPath, xml.documentElement, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null); var thisNode = iterator.iterateNext(); var str = ''; while (thisNode) { if (str) { str += ', '; } str += thisNode.textContent; thisNode = iterator.iterateNext(); } $("#result").text(str); }</script>\[/code\]this is html code:-\[code\]<body> <input type="text" id="select"> <input type="text" id="value"> <input type="button" name="button" value="http://stackoverflow.com/questions/15541506/Search" onclick="get_list('=')"> <div id="result"> </div></body>\[/code\]i have two textbox:-in first textbox enter latitude value \[code\]13.060422\[/code\] (its on my xml file)in second textbox enter longitude value \[code\]80.24958300000003\[/code\](its on my xml file)then both are match in my xml element value return all sibling value like\[code\]IN India Gujarat Rajkot 13.060422 80.24958300000003\[/code\]thanks
 
Back
Top