Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoPluginGeocoder can return successful but fail to parse_xml #22

Open
RobertLowe opened this issue Jun 1, 2011 · 0 comments
Open

GeoPluginGeocoder can return successful but fail to parse_xml #22

RobertLowe opened this issue Jun 1, 2011 · 0 comments

Comments

@RobertLowe
Copy link

-244-199-0.21566 14:48:16 ERROR Caught an error during GeoPluginGeocoder geocoding call: undefined method `text' for nil:NilClass

https://github.com/andre/geokit-gem/blob/master/lib/geokit/geocoders.rb#L755
https://github.com/andre/geokit-gem/blob/master/lib/geokit/geocoders.rb#L761

  def self.parse_xml(xml)
    xml = REXML::Document.new(xml)
    geo = GeoLoc.new
    geo.provider='geoPlugin'
    geo.city = xml.elements['//geoplugin_city'].text
    geo.state = xml.elements['//geoplugin_region'].text
    geo.country_code = xml.elements['//geoplugin_countryCode'].text
    geo.lat = xml.elements['//geoplugin_latitude'].text.to_f
    geo.lng = xml.elements['//geoplugin_longitude'].text.to_f
    geo.success = !!geo.city && !geo.city.empty?
    return geo
  end
RobertLowe added a commit to RobertLowe/geokit-gem that referenced this issue Jun 2, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant