aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nodejs/main.js5
-rw-r--r--src/nodejs/xmlGenerator.js21
2 files changed, 12 insertions, 14 deletions
diff --git a/src/nodejs/main.js b/src/nodejs/main.js
index 2c4cb26..49a36f5 100644
--- a/src/nodejs/main.js
+++ b/src/nodejs/main.js
@@ -48,12 +48,11 @@ function rowToNode(row){
if(row.tags != '{}') {
node.tags = [];
- // FIXME: something doesnt work at all
temp = row.tags.replace("{","").replace("}","").split(",");
for(var x=0;x<temp.length;x=x+2){
node.tags.push({
- 'k' : temp[x],
- 'v' : temp[x+1]
+ 'key' : temp[x],
+ 'value' : temp[x+1]
});
}
}
diff --git a/src/nodejs/xmlGenerator.js b/src/nodejs/xmlGenerator.js
index 921056d..5846717 100644
--- a/src/nodejs/xmlGenerator.js
+++ b/src/nodejs/xmlGenerator.js
@@ -11,20 +11,19 @@ log.setLevel(config.logLevel);
exports.createNode = function (node) {
log.debug(node);
var xmlNode = builder.begin('node')
- .att('id', node.id)
- .att('timestamp', node.timestamp)
- .att('version', node.version)
- .att('changeset', node.changeset)
- .att('lat', node.lat)
- .att('lon', node.lon);
+ .att('id', node.id)
+ .att('timestamp', node.timestamp)
+ .att('version', node.version)
+ .att('changeset', node.changeset)
+ .att('lat', node.lat)
+ .att('lon', node.lon);
if(node.tags) {
- var tags = node.tags;
- for(var x=0;x<tags.length;x=x+2){
+ node.tags.forEach(function(tuple){
xmlNode.ele('tag')
- .att('k',escape(tags[x]))
- .att('v',escape(tags[x+1]));
- }
+ .att('k',escape(tuple.key))
+ .att('v',escape(tuple.value));
+ });
}
return builder.toString({ pretty: true });
};