Consume content in all cases but error
This commit is contained in:
22
parser.js
22
parser.js
@@ -91,7 +91,7 @@ function registerEvents () {
|
|||||||
var explicitArray = this.opts.explicitArray
|
var explicitArray = this.opts.explicitArray
|
||||||
|
|
||||||
parser.on('startElement', function (name, attrs) {
|
parser.on('startElement', function (name, attrs) {
|
||||||
if (state.isRootNode) validateResourcePath(name)
|
if (state.isRootNode) state.isRootNode = false;
|
||||||
state.currentPath = state.currentPath + '/' + name
|
state.currentPath = state.currentPath + '/' + name
|
||||||
checkForResourcePath(name)
|
checkForResourcePath(name)
|
||||||
if (state.isPathfound) processStartElement(name, attrs)
|
if (state.isPathfound) processStartElement(name, attrs)
|
||||||
@@ -254,26 +254,6 @@ function registerEvents () {
|
|||||||
}
|
}
|
||||||
return jsonPath
|
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) {
|
function processError (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user