aboutsummaryrefslogtreecommitdiff
path: root/lib/xmlreader.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xmlreader.js')
-rw-r--r--lib/xmlreader.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/xmlreader.js b/lib/xmlreader.js
index 67dda38..3efad63 100644
--- a/lib/xmlreader.js
+++ b/lib/xmlreader.js
@@ -3,6 +3,7 @@ var sax = require("sax");
var _ = require("underscore");
exports.read = read;
+exports.Element = Element;
function read(xmlString) {
var parser = sax.parser(true, {xmlns: true, position: false});
@@ -61,11 +62,11 @@ function mapValues(input, mapper, context) {
}, {}, context);
}
-function Element(name, attributes) {
+function Element(name, attributes, children) {
this.type = "element";
this.name = name;
this.attributes = attributes;
- this.children = [];
+ this.children = children || [];
}
Element.prototype.first = function(name) {