backend v4 half
This commit is contained in:
+21
-8
@@ -1,9 +1,10 @@
|
||||
const { buildOptions} = require("./OptionsBuilder");
|
||||
const OrderedObjParser = require("./OrderedObjParser");
|
||||
const { prettify} = require("./node2json");
|
||||
const validator = require('../validator');
|
||||
import { buildOptions} from './OptionsBuilder.js';
|
||||
import OrderedObjParser from './OrderedObjParser.js';
|
||||
import prettify from './node2json.js';
|
||||
import {validate} from "../validator.js";
|
||||
import XmlNode from './xmlNode.js';
|
||||
|
||||
class XMLParser{
|
||||
export default class XMLParser{
|
||||
|
||||
constructor(options){
|
||||
this.externalEntities = {};
|
||||
@@ -25,7 +26,7 @@ class XMLParser{
|
||||
if( validationOption){
|
||||
if(validationOption === true) validationOption = {}; //validate with default options
|
||||
|
||||
const result = validator.validate(xmlData, validationOption);
|
||||
const result = validate(xmlData, validationOption);
|
||||
if (result !== true) {
|
||||
throw Error( `${result.err.msg}:${result.err.line}:${result.err.col}` )
|
||||
}
|
||||
@@ -53,6 +54,18 @@ class XMLParser{
|
||||
this.externalEntities[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = XMLParser;
|
||||
/**
|
||||
* Returns a Symbol that can be used to access the metadata
|
||||
* property on a node.
|
||||
*
|
||||
* If Symbol is not available in the environment, an ordinary property is used
|
||||
* and the name of the property is here returned.
|
||||
*
|
||||
* The XMLMetaData property is only present when `captureMetaData`
|
||||
* is true in the options.
|
||||
*/
|
||||
static getMetaDataSymbol() {
|
||||
return XmlNode.getMetaDataSymbol();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user