This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

[closed] Get XML results from Nominatim

1

Hi guys,

I'm trying to get search results from Nominatim in XML format. Here's my javascript code:

function requestToNominatim(){

    xmlhttp = getXMLHttpRequest();
    xmlhttp.onreadystatechange=function(){
        if (xmlhttp.readyState==4 && xmlhttp.status==200){
            var response = xmlhttp.responseXML;
            alert(response);
            }
    }

    var q = document.getElementById('q').value;
    xmlhttp.open("GET","http://localhost/nominatim/search.php?format=xml&q=" + q,true);
    xmlhttp.send(null);
}

The alert displays "[object Document]". However, when I display "responseText" I get the xml... Do you have any idea about getting directly the XMLDocument from responseXML?

Thanks! Lucas

asked 14 Jun '13, 14:42

Kalu06's gravatar image

Kalu06
1407815
accept rate: 0%

edited 17 Jun '13, 08:58

1

Finally, I ended up using JSON instead of XML. It's working as good and easier to manipulate.

Lucas

(17 Jun '13, 08:51) Kalu06

Source code available on GitHub .