]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/way.rb
Shut up libxml's "Must specify a string with one or more characters" error on relatio...
[rails.git] / app / models / way.rb
index 86b25e08e2fb44a9660bc197221e35d109b46f69..88bbaf6c59669229dfb221659389cf1605442d22 100644 (file)
@@ -27,14 +27,13 @@ class Way < ActiveRecord::Base
 
   def self.from_xml(xml, create=false)
     begin
-      p = XML::Parser.new
-      p.string = xml
+      p = XML::Parser.string(xml)
       doc = p.parse
 
       doc.find('//osm/way').each do |pt|
         return Way.from_xml_node(pt, create)
       end
-    rescue LibXML::XML::Error => ex
+    rescue LibXML::XML::Error, ArgumentError => ex
       raise OSM::APIBadXMLError.new("way", xml, ex.message)
     end
   end