Skip to content

Commit

Permalink
Add lexicalHandler support to SAX parser
Browse files Browse the repository at this point in the history
  • Loading branch information
danyaPostfactum committed Aug 10, 2014
1 parent af2e3fc commit bbbf557
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/sax/SAXParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var TreeParser = require('./TreeParser').TreeParser;

function SAXParser() {
this.contentHandler = null;
this.lexicalHandler = null;
this._errorHandler = null;
this._treeBuilder = new SAXTreeBuilder();
this._tokenizer = new Tokenizer(this._treeBuilder);
Expand All @@ -14,7 +15,7 @@ SAXParser.prototype.parse = function(source) {
this._tokenizer.tokenize(source);
var document = this._treeBuilder.document;
if (document) {
new TreeParser(this.contentHandler).parse(document);
new TreeParser(this.contentHandler, this.lexicalHandler).parse(document);
}
};

Expand All @@ -23,7 +24,7 @@ SAXParser.prototype.parseFragment = function(source, context) {
this._tokenizer.tokenize(source);
var fragment = this._treeBuilder.getFragment();
if (fragment) {
new TreeParser(this.contentHandler).parse(fragment);
new TreeParser(this.contentHandler, this.lexicalHandler).parse(fragment);
}
};

Expand Down
4 changes: 2 additions & 2 deletions lib/sax/SAXTreeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,8 @@ ProcessingInstruction.prototype.getNodeType = function() {
* @param publicIdentifier the public id
* @param systemIdentifier the system id
*/
function DTD(name, publicIdentifier, systemIdentifier) {
ParentNode.call(this);
function DTD(locator, name, publicIdentifier, systemIdentifier) {
ParentNode.call(this, locator);
this.name = name;
this.publicIdentifier = publicIdentifier;
this.systemIdentifier = systemIdentifier;
Expand Down

0 comments on commit bbbf557

Please sign in to comment.