Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function select(xpath: string) {
if (resultDom === undefined) {
throw new Error(
"resultDom was undefined in select(). Make sure you called setResultXml()"
);
}
try {
const nodes = XPATH.selectWithResolver(
xpath,
resultDom
//, resolver
);
return nodes;
} catch (ex) {
console.log("error in xpath: " + xpath);
console.log(ex);
throw new Error(`error in xpath: ${xpath} ${ex}`);
}
}
getFirstNodeMatchingXPath: function (expression, docOrElement) {
var match = xpath.selectWithResolver(expression, docOrElement, this.resolver, true);
return match;
},
selectMatchingXPath: function (expression, docOrElement) {
var matches = xpath.selectWithResolver(expression, docOrElement, this.resolver, false);
return matches;
},