I am using the google geocoding api in my app but im finding it hard to parse the returned address information reliably. Im hoping someone has a library or way of parsing the info to prevent me from having to write this my self and cover every case.
Im using the json api and can extract the address line and the coordinates easily enough and store them in a database, but the problem is extracting the other address information in a reliable way so i can store it.
I have had a look at the XAL structured address specification that google uses for the geocoded data but my problem is the fact that it can cater for every address type in every country makes it hard to parse the result.
Something as simple as a postcode can be nested pretty deep inside any combination of parent tags. even inside one country the way the tree appears can vary which makes it harder than expected to parse.
Ironically my end objective is to store it in a tree (think rails acts_as_tree or similar) in my database, so users can locate the items easily later. eg click on country, state, then region, town, then suburb etc
Im working in rails