var config; var builder = require('xmlbuilder'); //set up logger var log4js = require('log4js')(); //note the need to call the function //log4js.addAppender(log4js.fileAppender('osm-xapi.log'), 'cheese'); var log = log4js.getLogger('xmlGenerator'); // TODO how to get log level from main's config? 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); if(node.tags) { node.tags.forEach(function(tuple){ xmlNode.ele('tag') .att('k',escape(tuple.key)) .att('v',escape(tuple.value)); }); } return builder.toString({ pretty: true }); }; // FIXME: make this shit working exports.createWay = function (row) { var xmlWay = builder.begin('way') .att('id', row.id) .att('timestamp', row.timestamp) .att('version', row.version) .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"; }