Api Osm

I would like to communicate with the database of the OSM across an application JAVA. I would like to send a String
(a city, for example) and to obtain the map of the location of the String with its corresponding XML of mentioned map.
is it posible? How I can do it?
I wait for answers. Thank you very much !!!

There is a service called Name finder which will help you find lat/lon for place names, but this service is hard to do right (it’s called geocoding). Mostly you will get lots of matches amd jave to select the best match manually.

Then you can just download the map from Openstreetmap with the API or the extended API: osm xapi.