aboutsummaryrefslogtreecommitdiffstats
path: root/src/nodejs/xmlGenerator.js
diff options
context:
space:
mode:
authorslomo <steve.harrison@gmx.net>2011-01-29 03:00:36 +0100
committerslomo <steve.harrison@gmx.net>2011-01-29 03:00:36 +0100
commit831a90dd5fe9c200a4930ee4a23af3c3cfecff5b (patch)
tree0c57028f40adf13c0028ef983ccbef931ddad41b /src/nodejs/xmlGenerator.js
parent94168b354b72ab45ffd9ae1911d038f546fcafdb (diff)
downloadosm-xapi-831a90dd5fe9c200a4930ee4a23af3c3cfecff5b.tar.gz
osm-xapi-831a90dd5fe9c200a4930ee4a23af3c3cfecff5b.tar.xz
osm-xapi-831a90dd5fe9c200a4930ee4a23af3c3cfecff5b.zip
integrated query create function
Diffstat (limited to 'src/nodejs/xmlGenerator.js')
-rw-r--r--src/nodejs/xmlGenerator.js29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/nodejs/xmlGenerator.js b/src/nodejs/xmlGenerator.js
index a477457..6ba0191 100644
--- a/src/nodejs/xmlGenerator.js
+++ b/src/nodejs/xmlGenerator.js
@@ -30,23 +30,24 @@ exports.createNode = function (node) {
// FIXME: make this shit working
exports.createWay = function (row) {
- var way = builder.begin('way')
+ var xmlWay = builder.begin('way')
.att('id', row.id)
- .att('timestamp', toISO8601(row.tstamp))
+ .att('timestamp', row.timestamp)
.att('version', row.version)
- .att('changeset', row.changeset_id);
- if(row.tags != '{}') {
- temp = row.tags.replace("{","").replace("}","").split(",");
- for(var x=0;x<temp.length;x=x+2){
- way.ele('tag')
- .att('k',escape(temp[x]))
- .att('v',escape(temp[x+1]));
- }
- }
- temp = row.nodes.replace("{","").replace("}","").split(",");
- for(var i=0;i<temp.length;i++) {
- way.ele('nd').att('ref',temp[i]);
+ .att('changeset', row.changeset);
+
+ if(row.tags) {
+ row.tags.forEach(function(tuple){
+ xmlWay.ele('tag')
+ .att('k',escape(tuple.key))
+ .att('v',escape(tuple.value));
+ });
}
+
+ //temp = row.nodes.replace("{","").replace("}","").split(",");
+ //for(var i=0;i<temp.length;i++) {
+ // way.ele('nd').att('ref',temp[i]);
+ //}
return builder.toString({pretty:'true'});
};