Jose Campos
New Member
this is my xml file:-\[code\]<?xml version="1.0" encoding="UTF-8" standalone="yes"?><results xmlns="http://gisgraphy.com"> <result> <distance>1071.59873299109</distance> <name>Irungattukottai</name> <adm1Code>25</adm1Code> <adm1Name>State of Tamil Nadu</adm1Name> <asciiName>Irungattukottai</asciiName> <countryCode>IN</countryCode> <featureClass>P</featureClass> <featureCode>PPL</featureCode> <featureId>1269687</featureId> <gtopo30>47</gtopo30> <population>0</population> <timezone>Asia/Kolkata</timezone> <lat>12.996390342712402</lat> <lng>79.99082946777344</lng> <placeType>City</placeType> <oneWay>false</oneWay> <length>0.0</length> <google_map_url>http://maps.google.com/maps?f=q&ie=UTF-8&iwloc=addr&om=1&z=12&q=Irungattukottai&ll=13.026390342712402,79.99082946777344</google_map_url> <yahoo_map_url>http://maps.yahoo.com/broadband?mag=6&mvt=m&lon=79.99082946777344&lat=12.996390342712402</yahoo_map_url> <country_flag_url>/images/flags/IN.png</country_flag_url> </result> <result> <distance>1892.33578431928</distance> <name>Valapuram</name> <adm1Code>25</adm1Code> <adm1Name>State of Tamil Nadu</adm1Name> <asciiName>Valapuram</asciiName> <countryCode>IN</countryCode> <featureClass>P</featureClass> <featureCode>PPL</featureCode> <featureId>1466104</featureId> <gtopo30>33</gtopo30> <population>0</population> <timezone>Asia/Kolkata</timezone> <lat>13.016940116882324</lat> <lng>80.00167083740234</lng> <placeType>City</placeType> <oneWay>false</oneWay> <length>0.0</length> <google_map_url>http://maps.google.com/maps?f=q&ie=UTF-8&iwloc=addr&om=1&z=12&q=Valapuram&ll=13.046940116882324,80.00167083740234</google_map_url> <yahoo_map_url>http://maps.yahoo.com/broadband?mag=6&mvt=m&lon=80.00167083740234&lat=13.016940116882324</yahoo_map_url> <country_flag_url>/images/flags/IN.png</country_flag_url> </result></results>\[/code\]this is my complite code:-\[code\]<html><head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script> var xml; $.get( "search.xml", null, function (data) { xml = data; }, "xml" ); function get_list(ls) { var elName = $('#select').val(); var value = http://stackoverflow.com/questions/15631473/$('#value').val(); if(elName == "" || value =http://stackoverflow.com/questions/15631473/="") { } else if (elName != "" || value != "") { //var xPath = '//loction[ @lat '+ ls +' "'+elName+'" and @lng '+ ls +' "'+value+'"][1]/preceding-sibling::*/@*'; var xPath = '//result[lat='+elName+' and lng='+value+']/node()/text()'; //var xPathh = '//lng[@lng '+ ls +' "'+ value +'"]'+'/../City/@value'; 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); } else {} } </script></head><body> <input type="text" id="select"> <input type="text" id="value"> <input type="button" name="button" value="http://stackoverflow.com/questions/15631473/Search" onclick="get_list('=')"> <div id="result"> </div></body></html>\[/code\]
\[code\] i want:-\[/code\]i want to enter latitude and longitude value in text box if both are match in my xml file then return there sibling node value.
\[code\]problem:-\[/code\]I dont Know what is the problem if root element have an attribute value
like \[code\]<results xmlns="http://gisgraphy.com">\[/code\] its not work
if remove this attribute value then work perfect...
any idea for this its food help for me...
thanks
\[code\] i want:-\[/code\]i want to enter latitude and longitude value in text box if both are match in my xml file then return there sibling node value.
\[code\]problem:-\[/code\]I dont Know what is the problem if root element have an attribute value
like \[code\]<results xmlns="http://gisgraphy.com">\[/code\] its not work
if remove this attribute value then work perfect...
any idea for this its food help for me...
thanks