Made XML parsing routines raise an exception if the document is valid XML, but not valid as an OSM document. This is now the same behaviour as when the document isn't valid XML.

This commit is contained in:
Matt Amos 2009-08-06 17:28:49 +00:00
parent a9a55db130
commit bb84a78a09
4 changed files with 21 additions and 0 deletions

View file

@ -33,6 +33,7 @@ class Relation < ActiveRecord::Base
doc.find('//osm/relation').each do |pt|
return Relation.from_xml_node(pt, create)
end
raise OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/relation element.")
rescue LibXML::XML::Error, ArgumentError => ex
raise OSM::APIBadXMLError.new("relation", xml, ex.message)
end