Работа над XmlParser

This commit is contained in:
Book Pauk
2022-11-09 16:37:10 +07:00
parent f1db203027
commit b64c5de5a3
2 changed files with 119 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
const sax = require('./sax');
const ObjectNavigator = require('./ObjectNavigator');
//node types
const NODE = 1;
@@ -78,11 +79,11 @@ class NodeBase {
}
class NodeObject extends NodeBase {
constructor(rawNode) {
constructor(raw = null) {
super();
if (rawNode)
this.raw = rawNode;
if (raw)
this.raw = raw;
else
this.raw = [];
}
@@ -748,6 +749,10 @@ class XmlParser extends NodeBase {
return this;
}
navigator() {
return new ObjectNavigator(this.toObject());
}
}
module.exports = XmlParser;