From b9503646067bf393dca0b79de3dcf159c38d6e8a Mon Sep 17 00:00:00 2001 From: n1073645 Date: Fri, 17 Apr 2020 15:07:02 +0100 Subject: [PATCH] Removed the require --- src/core/operations/XMLValidator.mjs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/operations/XMLValidator.mjs b/src/core/operations/XMLValidator.mjs index 035d5f37..9c13b4d9 100644 --- a/src/core/operations/XMLValidator.mjs +++ b/src/core/operations/XMLValidator.mjs @@ -6,6 +6,7 @@ import Operation from "../Operation.mjs"; import OperationError from "../errors/OperationError.mjs"; +import DOMParser from "xmldom"; /** * XML Validator operation @@ -34,11 +35,9 @@ class XMLValidator extends Operation { */ run(input, args) { - const DOMParser = require("xmldom").DOMParser; - try { // Overwrite error handler since the built-in one does not raise exceptions. - (new DOMParser({errorHandler: { + (new DOMParser.DOMParser({errorHandler: { warning: (msg) => { throw new OperationError(msg); },