1
- ' use strict' ;
1
+ " use strict" ;
2
2
3
3
const Sax = require ( 'sax' ) ;
4
4
const PromiseLib = require ( '../../utils/promise' ) ;
5
5
6
- const XmlStream = require ( ' ../../utils/xml-stream' ) ;
6
+ const XmlStream = require ( " ../../utils/xml-stream" ) ;
7
7
8
8
/* 'virtual' methods used as a form of documentation */
9
9
/* eslint-disable class-methods-use-this */
@@ -65,25 +65,26 @@ class BaseXform {
65
65
const abort = error => {
66
66
// Abandon ship! Prevent the parser from consuming any more resources
67
67
parser . removeAllListeners ( ) ;
68
+ parser . on ( "error" , ( ) => { } ) ; // Ignore any parse errors from the chunk being processed
68
69
stream . unpipe ( parser ) ;
69
70
reject ( error ) ;
70
71
} ;
71
72
72
- parser . on ( ' opentag' , node => {
73
+ parser . on ( " opentag" , node => {
73
74
try {
74
75
this . parseOpen ( node ) ;
75
76
} catch ( error ) {
76
77
abort ( error ) ;
77
78
}
78
79
} ) ;
79
- parser . on ( ' text' , text => {
80
+ parser . on ( " text" , text => {
80
81
try {
81
82
this . parseText ( text ) ;
82
83
} catch ( error ) {
83
84
abort ( error ) ;
84
85
}
85
86
} ) ;
86
- parser . on ( ' closetag' , name => {
87
+ parser . on ( " closetag" , name => {
87
88
try {
88
89
if ( ! this . parseClose ( name ) ) {
89
90
resolve ( this . model ) ;
@@ -96,7 +97,7 @@ class BaseXform {
96
97
parser . on ( 'end' , ( ) => {
97
98
resolve ( this . model ) ;
98
99
} ) ;
99
- parser . on ( ' error' , error => {
100
+ parser . on ( " error" , error => {
100
101
abort ( error ) ;
101
102
} ) ;
102
103
} ) ;
0 commit comments