- break if p.node_type == 15 # end element
- next unless p.node_type == 1 # element
-
- case p.name
- when 'create':
- while p.read == 1
- break if p.node_type == 15 # end element
- next unless p.node_type == 1 # element
-
- model = models[p.name]
- next if model.nil?
-
- elem = XML::Node.new p.name
- nd = p.expand; p.next
- osm = model.from_xml_node(nd, true)
- elem['old_id'] = nd['id']
-
- case nd.name
- when 'way':
- fix_way(osm, node_ids)
- raise OSM::APIPreconditionFailedError.new if !osm.preconditions_ok?
- when 'relation':
- fix_rel(osm, ids)
- raise OSM::APIPreconditionFailedError.new if !osm.preconditions_ok?
- end
-
- create_prim ids[nd.name], osm, nd
- elem['new_id'] = osm.id.to_s
- elem['new_version'] = osm.version.to_s
- root << elem
- end
- when 'modify':
- while p.read == 1
- break if p.node_type == 15 # end element
- next unless p.node_type == 1 # element
-
- model = models[p.name]
- next if model.nil?
-
- elem = XML::Node.new p.name
- new_osm = model.from_xml_node(p.expand); p.next
- osm = model.find(new_osm.id)
- osm.update_from new_osm, @user
- elem['old_id'] = elem['new_id'] = osm.id.to_s
- elem['new_version'] = osm.version.to_s
- root << elem
- end
- when 'delete':
- while p.read == 1
- break if p.node_type == 15 # end element
- next unless p.node_type == 1 # element
-
- model = models[p.name]
- next if model.nil?
-
- elem = XML::Node.new p.name
- osm = model.find(p.expand['id']); p.next
- osm.delete_with_history(@user)
- elem['old_id'] = elem['new_id'] = osm.id.to_s
- elem['new_version'] = osm.version.to_s
- root << elem
- end
- end
+ break if p.node_type == 15 # end element
+ next unless p.node_type == 1 # element
+
+ case p.name
+ when 'create':
+ while p.read == 1
+ break if p.node_type == 15 # end element
+ next unless p.node_type == 1 # element
+
+ model = models[p.name]
+ next if model.nil?
+
+ elem = XML::Node.new p.name
+ nd = p.expand; p.next
+ osm = model.from_xml_node(nd, true)
+ elem['old_id'] = nd['id']
+
+ case nd.name
+ when 'way':
+ fix_way(osm, node_ids)
+ raise OSM::APIPreconditionFailedError.new if !osm.preconditions_ok?
+ when 'relation':
+ fix_rel(osm, ids)
+ raise OSM::APIPreconditionFailedError.new if !osm.preconditions_ok?
+ end
+
+ create_prim ids[nd.name], osm, nd
+ elem['new_id'] = osm.id.to_s
+ elem['new_version'] = osm.version.to_s
+ root << elem
+ end
+ when 'modify':
+ while p.read == 1
+ break if p.node_type == 15 # end element
+ next unless p.node_type == 1 # element
+
+ model = models[p.name]
+ next if model.nil?
+
+ elem = XML::Node.new p.name
+ new_osm = model.from_xml_node(p.expand); p.next
+ osm = model.find(new_osm.id)
+ osm.update_from new_osm, @user
+ elem['old_id'] = elem['new_id'] = osm.id.to_s
+ elem['new_version'] = osm.version.to_s
+ root << elem
+ end
+ when 'delete':
+ while p.read == 1
+ break if p.node_type == 15 # end element
+ next unless p.node_type == 1 # element
+
+ model = models[p.name]
+ next if model.nil?
+
+ elem = XML::Node.new p.name
+ osm = model.find(p.expand['id']); p.next
+ osm.delete_with_history(@user)
+ elem['old_id'] = elem['new_id'] = osm.id.to_s
+ elem['new_version'] = osm.version.to_s
+ root << elem
+ end
+ end