Cheap addition of node order. Fixes #94
This commit is contained in:
parent
754221fd2e
commit
ac00f32e0d
@ -82,10 +82,12 @@ exports.compareToFile = function(value, originalFile, resultFile) {
|
|||||||
|
|
||||||
exports.parseXML = function(xml, callback) {
|
exports.parseXML = function(xml, callback) {
|
||||||
var parser = sax.parser(true);
|
var parser = sax.parser(true);
|
||||||
|
var i = 0;
|
||||||
var tree = [ {} ];
|
var tree = [ {} ];
|
||||||
|
|
||||||
parser.onopentag = function(node) {
|
parser.onopentag = function(node) {
|
||||||
if (!(node.name in tree[0])) tree[0][node.name] = [];
|
if (!(node.name in tree[0])) tree[0][node.name] = [];
|
||||||
|
node.attributes.__order__ = i++;
|
||||||
tree[0][node.name].push(node.attributes);
|
tree[0][node.name].push(node.attributes);
|
||||||
tree.unshift(node.attributes);
|
tree.unshift(node.attributes);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user