aboutsummaryrefslogtreecommitdiffstats
path: root/src/nodejs/xmlGenerator.js
diff options
context:
space:
mode:
authorslomo <steve.harrison@gmx.net>2011-01-22 13:44:34 +0100
committerslomo <steve.harrison@gmx.net>2011-01-22 13:44:34 +0100
commitdd99a3158caa9c8fb31c7d6c9c0f6536376e2459 (patch)
treead4fdb0a8cf21ff1d30a5267043797b8636191ba /src/nodejs/xmlGenerator.js
parent1a37a20fd94a60ce686a6f1e11534b504b2e2308 (diff)
downloadosm-xapi-dd99a3158caa9c8fb31c7d6c9c0f6536376e2459.tar.gz
osm-xapi-dd99a3158caa9c8fb31c7d6c9c0f6536376e2459.tar.xz
osm-xapi-dd99a3158caa9c8fb31c7d6c9c0f6536376e2459.zip
added tag support
Diffstat (limited to '')
-rw-r--r--src/nodejs/xmlGenerator.js21
1 files changed, 10 insertions, 11 deletions
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 });
};