From 9636bac02a2cf59fa573314a5f15de1d835260a2 Mon Sep 17 00:00:00 2001 From: Mark Engel Date: Fri, 21 Jan 2011 17:20:43 +0100 Subject: refactored creation of xml way to own function --- src/nodejs/no1.js | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/nodejs/no1.js b/src/nodejs/no1.js index c31bc5f..047b9a2 100644 --- a/src/nodejs/no1.js +++ b/src/nodejs/no1.js @@ -99,12 +99,12 @@ function nodeBboxHandler(req, res, key, value, left, bottom, right, top) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.write(""); } - res.write(createXmlFromRow(row)); + res.write(createXmlNode(row)); }); }); } -function createXmlFromRow(row) { +function createXmlNode(row) { console.log(row); var node = builder.begin('node') .att('id', row.id) @@ -123,6 +123,28 @@ function createXmlFromRow(row) { return builder.toString({ pretty: true }); } +function createXmlWay(row) { + var way = builder.begin('way') + .att('id', row.id) + .att('timestamp', toISO8601(row.tstamp)) + .att('version', row.version) + .att('changeset', row.changeset_id); + if(row.tags != '{}') { + var temp = row.tags.replace("{","").replace("}","").split(","); + for(var x=0;x