From 32aef91cdee89c12df6420a6174724c7f9065e0e Mon Sep 17 00:00:00 2001 From: Ludovic POLLET Date: Wed, 5 Sep 2018 16:56:16 +0200 Subject: [PATCH] Consume content in all cases but error --- parser.js | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/parser.js b/parser.js index a1c60c1..6c93a2c 100644 --- a/parser.js +++ b/parser.js @@ -91,7 +91,7 @@ function registerEvents () { var explicitArray = this.opts.explicitArray parser.on('startElement', function (name, attrs) { - if (state.isRootNode) validateResourcePath(name) + if (state.isRootNode) state.isRootNode = false; state.currentPath = state.currentPath + '/' + name checkForResourcePath(name) if (state.isPathfound) processStartElement(name, attrs) @@ -254,26 +254,6 @@ function registerEvents () { } return jsonPath } - - function validateResourcePath (name) { - var temp - var index - - state.isRootNode = false - - if (resourcePath) { - if (resourcePath[0] === '/') { - temp = resourcePath.substring(1, resourcePath.length) - } else { - temp = resourcePath - } - index = temp.indexOf('/') - if (index !== -1) temp = temp.substring(0, index) - if (temp !== name) { - scope.end() - } - } - } } function processError (err) {