| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -105,7 +105,7 @@ EasySAXParser.prototype.on = function(name, cb) { | |||
| 105 | 105 | case 'error': this.onError = cb || nullFunc; break; | |
| 106 | 106 | case 'startNode': this.onStartNode = cb || nullFunc; break; | |
| 107 | 107 | case 'endNode': this.onEndNode = cb || nullFunc; break; | |
| 108 | - case 'textNode': onTextNode = cb || nullFunc; break; | ||
| 108 | + case 'textNode': this.onTextNode = cb || nullFunc; break; | ||
| 109 | 109 | case 'cdata': this.onCDATA = cb || nullFunc; break; | |
| 110 | 110 | ||
| 111 | 111 | case 'comment': this.onComment = cb; this.is_onComment = !!cb; break; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ import xml = require('xml'); | |||
| 4 | 4 | describe("xml parser", () => { | |
| 5 | 5 | let last_element = null; | |
| 6 | 6 | let last_attrs = null; | |
| 7 | + let last_data = null; | ||
| 7 | 8 | let parser = null; | |
| 8 | 9 | ||
| 9 | 10 | beforeEach(() => { | |
@@ -13,6 +14,9 @@ describe("xml parser", () => { | |||
| 13 | 14 | last_element = event.elementName; | |
| 14 | 15 | last_attrs = event.attributes; | |
| 15 | 16 | break; | |
| 17 | + case xml.ParserEventType.Text: | ||
| 18 | + last_data = event.data; | ||
| 19 | + break; | ||
| 16 | 20 | } | |
| 17 | 21 | }); | |
| 18 | 22 | }); | |
@@ -26,4 +30,9 @@ describe("xml parser", () => { | |||
| 26 | 30 | assert.equal('TextField', last_element); | |
| 27 | 31 | assert.equal('hello', last_attrs['text']); | |
| 28 | 32 | }); | |
| 33 | + | ||
| 34 | + it("resolves entities", () => { | ||
| 35 | + parser.parse("<element><>"&'</element>"); | ||
| 36 | + assert.equal("<>\"&'", last_data); | ||
| 37 | + }); | ||
| 29 | 38 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments