- doc.find('//osm/create/node').each do |nd|
- elem = XML::Node.new 'node'
- node = Node.from_xml_node(nd, true)
- elem['old_id'] = nd['id']
- create_prim node_ids, node, nd
- elem['new_id'] = node.id.to_s
- elem['new_version'] = node.version.to_s
- root << elem
- end
- doc.find('//osm/create/way').each do |nd|
- elem = XML::Node.new 'way'
- way = Way.from_xml_node(nd, true)
- elem['old_id'] = nd['id']
- fix_way(way, node_ids)
- raise OSM::APIPreconditionFailedError.new if !way.preconditions_ok?
- create_prim way_ids, way, nd
- elem['new_id'] = way.id.to_s
- elem['new_version'] = way.version.to_s
- root << elem
- end
- doc.find('//osm/create/relation').each do |nd|
- elem = XML::Node.new 'relation'
- relation = Relation.from_xml_node(nd, true)
- elem['old_id'] = nd['id']
- fix_rel(relation, ids)
- raise OSM::APIPreconditionFailedError.new if !relation.preconditions_ok?
- create_prim rel_ids, relation, nd
- elem['new_id'] = relation.id.to_s
- elem['new_version'] = relation.version.to_s
- root << elem
- end
-
- doc.find('//osm/modify/relation').each do |nd|
- elem = XML::Node.new 'relation'
- new_relation = Relation.from_xml_node(nd)
- relation = Relation.find(new_relation.id)
- relation.update_from new_relation, @user
- elem['old_id'] = elem['new_id'] = relation.id.to_s
- elem['new_version'] = relation.version.to_s
- root << elem
- end
- doc.find('//osm/modify/way').each do |nd|
- elem = XML::Node.new 'way'
- new_way = Way.from_xml_node(nd)
- way = Way.find(new_way.id)
- way.update_from new_way, @user
- elem['old_id'] = elem['new_id'] = way.id.to_s
- elem['new_version'] = way.version.to_s
- root << elem
- end
- doc.find('//osm/modify/node').each do |nd|
- elem = XML::Node.new 'node'
- new_node = Node.from_xml_node(nd)
- node = Node.find(new_node.id)
- node.update_from new_node, @user
- elem['old_id'] = elem['new_id'] = node.id.to_s
- elem['new_version'] = node.version.to_s
- root << elem
- end