- p = XML::Parser.new
- p.string = request.raw_post
- doc = p.parse
-
- prefs = []
-
- keyhash = {}
-
- doc.find('//preferences/preference').each do |pt|
- pref = UserPreference.new
+ p = XML::Parser.string(request.raw_post)
+ rescue LibXML::XML::Error, ArgumentError => ex
+ raise OSM::APIBadXMLError.new("preferences", xml, ex.message)
+ end
+ doc = p.parse