{"version":3,"sources":["webpack://parser/webpack/bootstrap","webpack://parser/./src/util.js","webpack://parser/./src/xmlstr2xmlnode.js","webpack://parser/./src/parser.js","webpack://parser/./src/node2json.js","webpack://parser/./src/xmlNode.js","webpack://parser/./src/nimndata.js","webpack://parser/./src/node2json_str.js","webpack://parser/./src/validator.js","webpack://parser/./src/json2xml.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","doesMatch","string","regex","match","exec","isExist","v","isEmptyObject","obj","keys","length","merge","target","a","len","getValue","buildOptions","options","defaultOptions","props","newOptions","undefined","doesNotMatch","getAllMatches","matches","allmatches","index","push","util","require","xmlNode","TagType","OPENING","CLOSING","SELF","CDATA","regx","Number","parseInt","window","parseFloat","attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","ignoreNameSpace","allowBooleanAttributes","parseNodeValue","parseAttributeValue","arrayMode","trimValues","cdataTagName","cdataPositionChar","localeRange","tagValueProcessor","attrValueProcessor","stopNodes","processTagValue","val","trim","parseValue","parseTrueNumberOnly","resolveNameSpace","tagname","tags","split","prefix","charAt","shouldParse","parsed","isNaN","indexOf","String","attrsRegx","RegExp","buildAttributesMap","attrStr","replace","attrs","attrName","attrCollection","getTraversalObj","xmlData","xmlObj","currentNode","tagsRegx","tag","nextTag","tagType","substr","parent","includes","child","attrsMap","startIndex","childNode","addChild","nodeToJson","xmlToNodeobj","x2xmlnode","parse","convertToJson","convertTonimn","convert2nimn","convertToJsonString","validate","j2xParser","parseToNimn","schema","node","jObj","this","Array","isArray","char","fromCharCode","chars","nilChar","missingChar","nilPremitive","missingPremitive","emptyChar","emptyValue","boundryChar","objStart","arrStart","arrayEnd","charsArr","_e","e_schema","hasValidData","str","itemSchema","arr_len","arr_i","processValue","isAppChar","ch","x2j","_cToJsonStr","level","indentBy","readPI","start","err","code","msg","readCommentAndCDATA","angleBracketsCount","tagFound","regxAttrName","regxTagName","closingTag","tagName","substring","validateTagName","result","readAttributeStr","isValid","validateAttributeString","tagClosed","otg","pop","JSON","stringify","doubleQuote","singleQuote","startChar","validAttrStrRegxp","attrNames","validateAttrName","format","supressEmptyNode","Parser","isAttribute","attrPrefixLen","isCDATA","replaceCDATAstr","replaceCDATAarr","indentate","tagEndChar","newLine","buildTextNode","buildEmptyTextNode","buildObjNode","buildEmptyObjNode","buildTextValNode","buildObjectNode","cdata","join","repeat","startsWith","j2x","Date","attr","arrLen","j","item","Ks","L"],"mappings":"uBACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QA0DA,OArDAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UAC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AAKqK,EAAOhF,QAASgE,IAIhE,MAAO,CAAChE,QAASA,EAASlB,IAAKA,IA2GjC3F,EAAOD,QAAU+M","file":"./lib/parser.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","'use strict';\n\nconst getAllMatches = function(string, regex) {\n const matches = [];\n let match = regex.exec(string);\n while (match) {\n const allmatches = [];\n const len = match.length;\n for (let index = 0; index < len; index++) {\n allmatches.push(match[index]);\n }\n matches.push(allmatches);\n match = regex.exec(string);\n }\n return matches;\n};\n\nconst doesMatch = function(string, regex) {\n const match = regex.exec(string);\n return !(match === null || typeof match === 'undefined');\n};\n\nconst doesNotMatch = function(string, regex) {\n return !doesMatch(string, regex);\n};\n\nexports.isExist = function(v) {\n return typeof v !== 'undefined';\n};\n\nexports.isEmptyObject = function(obj) {\n return Object.keys(obj).length === 0;\n};\n\n/**\n * Copy all the properties of a into b.\n * @param {*} target\n * @param {*} a\n */\nexports.merge = function(target, a) {\n if (a) {\n const keys = Object.keys(a); // will return an array of own properties\n const len = keys.length; //don't make it inline\n for (let i = 0; i < len; i++) {\n target[keys[i]] = a[keys[i]];\n }\n }\n};\n/* exports.merge =function (b,a){\n return Object.assign(b,a);\n} */\n\nexports.getValue = function(v) {\n if (exports.isExist(v)) {\n return v;\n } else {\n return '';\n }\n};\n\n// const fakeCall = function(a) {return a;};\n// const fakeCallNoReturn = function() {};\n\nexports.buildOptions = function(options, defaultOptions, props) {\n var newOptions = {};\n if (!options) {\n return defaultOptions; //if there are not options\n }\n\n for (let i = 0; i < props.length; i++) {\n if (options[props[i]] !== undefined) {\n newOptions[props[i]] = options[props[i]];\n } else {\n newOptions[props[i]] = defaultOptions[props[i]];\n }\n }\n return newOptions;\n};\n\nexports.doesMatch = doesMatch;\nexports.doesNotMatch = doesNotMatch;\nexports.getAllMatches = getAllMatches;\n","'use strict';\n\nconst util = require('./util');\nconst buildOptions = require('./util').buildOptions;\nconst xmlNode = require('./xmlNode');\nconst TagType = {OPENING: 1, CLOSING: 2, SELF: 3, CDATA: 4};\nlet regx =\n '<((!\\\\[CDATA\\\\[([\\\\s\\\\S]*?)(]]>))|(([\\\\w:\\\\-._]*:)?([\\\\w:\\\\-._]+))([^>]*)>|((\\\\/)(([\\\\w:\\\\-._]*:)?([\\\\w:\\\\-._]+))\\\\s*>))([^<]*)';\n\n//const tagsRegx = new RegExp(\"<(\\\\/?[\\\\w:\\\\-\\._]+)([^>]*)>(\\\\s*\"+cdataRegx+\")*([^<]+)?\",\"g\");\n//const tagsRegx = new RegExp(\"<(\\\\/?)((\\\\w*:)?([\\\\w:\\\\-\\._]+))([^>]*)>([^<]*)(\"+cdataRegx+\"([^<]*))*([^<]+)?\",\"g\");\n\n//polyfill\nif (!Number.parseInt && window.parseInt) {\n Number.parseInt = window.parseInt;\n}\nif (!Number.parseFloat && window.parseFloat) {\n Number.parseFloat = window.parseFloat;\n}\n\nconst defaultOptions = {\n attributeNamePrefix: '@_',\n attrNodeName: false,\n textNodeName: '#text',\n ignoreAttributes: true,\n ignoreNameSpace: false,\n allowBooleanAttributes: false, //a tag can have attributes without any value\n //ignoreRootElement : false,\n parseNodeValue: true,\n parseAttributeValue: false,\n arrayMode: false,\n trimValues: true, //Trim string values of tag and attributes\n cdataTagName: false,\n cdataPositionChar: '\\\\c',\n localeRange: '',\n tagValueProcessor: function(a) {\n return a;\n },\n attrValueProcessor: function(a) {\n return a;\n },\n stopNodes: []\n //decodeStrict: false,\n};\n\nexports.defaultOptions = defaultOptions;\n\nconst props = [\n 'attributeNamePrefix',\n 'attrNodeName',\n 'textNodeName',\n 'ignoreAttributes',\n 'ignoreNameSpace',\n 'allowBooleanAttributes',\n 'parseNodeValue',\n 'parseAttributeValue',\n 'arrayMode',\n 'trimValues',\n 'cdataTagName',\n 'cdataPositionChar',\n 'localeRange',\n 'tagValueProcessor',\n 'attrValueProcessor',\n 'parseTrueNumberOnly',\n 'stopNodes'\n];\nexports.props = props;\n\nconst getTraversalObj = function(xmlData, options) {\n options = buildOptions(options, defaultOptions, props);\n //xmlData = xmlData.replace(/\\r?\\n/g, \" \");//make it single line\n xmlData = xmlData.replace(//g, ''); //Remove comments\n\n const xmlObj = new xmlNode('!xml');\n let currentNode = xmlObj;\n\n regx = regx.replace(/\\[\\\\w/g, '[' + options.localeRange + '\\\\w');\n const tagsRegx = new RegExp(regx, 'g');\n let tag = tagsRegx.exec(xmlData);\n let nextTag = tagsRegx.exec(xmlData);\n while (tag) {\n const tagType = checkForTagType(tag);\n\n if (tagType === TagType.CLOSING) {\n //add parsed data to parent node\n if (currentNode.parent && tag[14]) {\n currentNode.parent.val = util.getValue(currentNode.parent.val) + '' + processTagValue(tag[14], options);\n }\n if (options.stopNodes.length && options.stopNodes.includes(currentNode.tagname)) {\n currentNode.child = []\n if (currentNode.attrsMap == undefined) { currentNode.attrsMap = {}}\n currentNode.val = xmlData.substr(currentNode.startIndex + 1, tag.index - currentNode.startIndex - 1)\n }\n currentNode = currentNode.parent;\n } else if (tagType === TagType.CDATA) {\n if (options.cdataTagName) {\n //add cdata node\n const childNode = new xmlNode(options.cdataTagName, currentNode, tag[3]);\n childNode.attrsMap = buildAttributesMap(tag[8], options);\n currentNode.addChild(childNode);\n //for backtracking\n currentNode.val = util.getValue(currentNode.val) + options.cdataPositionChar;\n //add rest value to parent node\n if (tag[14]) {\n currentNode.val += processTagValue(tag[14], options);\n }\n } else {\n currentNode.val = (currentNode.val || '') + (tag[3] || '') + processTagValue(tag[14], options);\n }\n } else if (tagType === TagType.SELF) {\n if (currentNode && tag[14]) {\n currentNode.val = util.getValue(currentNode.val) + '' + processTagValue(tag[14], options);\n }\n\n const childNode = new xmlNode(options.ignoreNameSpace ? tag[7] : tag[5], currentNode, '');\n if (tag[8] && tag[8].length > 0) {\n tag[8] = tag[8].substr(0, tag[8].length - 1);\n }\n childNode.attrsMap = buildAttributesMap(tag[8], options);\n currentNode.addChild(childNode);\n } else {\n //TagType.OPENING\n const childNode = new xmlNode(\n options.ignoreNameSpace ? tag[7] : tag[5],\n currentNode,\n processTagValue(tag[14], options)\n );\n if (options.stopNodes.length && options.stopNodes.includes(childNode.tagname)) {\n childNode.startIndex=tag.index + tag[1].length\n }\n childNode.attrsMap = buildAttributesMap(tag[8], options);\n currentNode.addChild(childNode);\n currentNode = childNode;\n }\n\n tag = nextTag;\n nextTag = tagsRegx.exec(xmlData);\n }\n\n return xmlObj;\n};\n\nfunction processTagValue(val, options) {\n if (val) {\n if (options.trimValues) {\n val = val.trim();\n }\n val = options.tagValueProcessor(val);\n val = parseValue(val, options.parseNodeValue, options.parseTrueNumberOnly);\n }\n\n return val;\n}\n\nfunction checkForTagType(match) {\n if (match[4] === ']]>') {\n return TagType.CDATA;\n } else if (match[10] === '/') {\n return TagType.CLOSING;\n } else if (typeof match[8] !== 'undefined' && match[8].substr(match[8].length - 1) === '/') {\n return TagType.SELF;\n } else {\n return TagType.OPENING;\n }\n}\n\nfunction resolveNameSpace(tagname, options) {\n if (options.ignoreNameSpace) {\n const tags = tagname.split(':');\n const prefix = tagname.charAt(0) === '/' ? '/' : '';\n if (tags[0] === 'xmlns') {\n return '';\n }\n if (tags.length === 2) {\n tagname = prefix + tags[1];\n }\n }\n return tagname;\n}\n\nfunction parseValue(val, shouldParse, parseTrueNumberOnly) {\n if (shouldParse && typeof val === 'string') {\n let parsed;\n if (val.trim() === '' || isNaN(val)) {\n parsed = val === 'true' ? true : val === 'false' ? false : val;\n } else {\n if (val.indexOf('0x') !== -1) {\n //support hexa decimal\n parsed = Number.parseInt(val, 16);\n } else if (val.indexOf('.') !== -1) {\n parsed = Number.parseFloat(val);\n } else {\n parsed = Number.parseInt(val, 10);\n }\n if (parseTrueNumberOnly) {\n parsed = String(parsed) === val ? parsed : val;\n }\n }\n return parsed;\n } else {\n if (util.isExist(val)) {\n return val;\n } else {\n return '';\n }\n }\n}\n\n//TODO: change regex to capture NS\n//const attrsRegx = new RegExp(\"([\\\\w\\\\-\\\\.\\\\:]+)\\\\s*=\\\\s*(['\\\"])((.|\\n)*?)\\\\2\",\"gm\");\nconst attrsRegx = new RegExp('([^\\\\s=]+)\\\\s*(=\\\\s*([\\'\"])(.*?)\\\\3)?', 'g');\n\nfunction buildAttributesMap(attrStr, options) {\n if (!options.ignoreAttributes && typeof attrStr === 'string') {\n attrStr = attrStr.replace(/\\r?\\n/g, ' ');\n //attrStr = attrStr || attrStr.trim();\n\n const matches = util.getAllMatches(attrStr, attrsRegx);\n const len = matches.length; //don't make it inline\n const attrs = {};\n for (let i = 0; i < len; i++) {\n const attrName = resolveNameSpace(matches[i][1], options);\n if (attrName.length) {\n if (matches[i][4] !== undefined) {\n if (options.trimValues) {\n matches[i][4] = matches[i][4].trim();\n }\n matches[i][4] = options.attrValueProcessor(matches[i][4]);\n attrs[options.attributeNamePrefix + attrName] = parseValue(\n matches[i][4],\n options.parseAttributeValue,\n options.parseTrueNumberOnly\n );\n } else if (options.allowBooleanAttributes) {\n attrs[options.attributeNamePrefix + attrName] = true;\n }\n }\n }\n if (!Object.keys(attrs).length) {\n return;\n }\n if (options.attrNodeName) {\n const attrCollection = {};\n attrCollection[options.attrNodeName] = attrs;\n return attrCollection;\n }\n return attrs;\n }\n}\n\nexports.getTraversalObj = getTraversalObj;\n","'use strict';\n\nconst nodeToJson = require('./node2json');\nconst xmlToNodeobj = require('./xmlstr2xmlnode');\nconst x2xmlnode = require('./xmlstr2xmlnode');\nconst buildOptions = require('./util').buildOptions;\n\nexports.parse = function(xmlData, options) {\n options = buildOptions(options, x2xmlnode.defaultOptions, x2xmlnode.props);\n return nodeToJson.convertToJson(xmlToNodeobj.getTraversalObj(xmlData, options), options);\n};\nexports.convertTonimn = require('../src/nimndata').convert2nimn;\nexports.getTraversalObj = xmlToNodeobj.getTraversalObj;\nexports.convertToJson = nodeToJson.convertToJson;\nexports.convertToJsonString = require('./node2json_str').convertToJsonString;\nexports.validate = require('./validator').validate;\nexports.j2xParser = require('./json2xml');\nexports.parseToNimn = function(xmlData, schema, options) {\n return exports.convertTonimn(exports.getTraversalObj(xmlData, options), schema, options);\n};\n","'use strict';\n\nconst util = require('./util');\n\nconst convertToJson = function(node, options) {\n const jObj = {};\n\n //when no child node or attr is present\n if ((!node.child || util.isEmptyObject(node.child)) && (!node.attrsMap || util.isEmptyObject(node.attrsMap))) {\n return util.isExist(node.val) ? node.val : '';\n } else {\n //otherwise create a textnode if node has some text\n if (util.isExist(node.val)) {\n if (!(typeof node.val === 'string' && (node.val === '' || node.val === options.cdataPositionChar))) {\n jObj[options.textNodeName] = node.val;\n }\n }\n }\n\n util.merge(jObj, node.attrsMap);\n\n const keys = Object.keys(node.child);\n for (let index = 0; index < keys.length; index++) {\n var tagname = keys[index];\n if (node.child[tagname] && node.child[tagname].length > 1) {\n jObj[tagname] = [];\n for (var tag in node.child[tagname]) {\n jObj[tagname].push(convertToJson(node.child[tagname][tag], options));\n }\n } else {\n jObj[tagname] = convertToJson(node.child[tagname][0], options);\n }\n }\n\n //add value\n return jObj;\n};\n\nexports.convertToJson = convertToJson;\n","'use strict';\n\nmodule.exports = function(tagname, parent, val) {\n this.tagname = tagname;\n this.parent = parent;\n this.child = {}; //child tags\n this.attrsMap = {}; //attributes map\n this.val = val; //text only\n this.addChild = function(child) {\n if (Array.isArray(this.child[child.tagname])) {\n //already presents\n this.child[child.tagname].push(child);\n } else {\n this.child[child.tagname] = [child];\n }\n };\n};\n","'use strict';\nconst char = function(a) {\n return String.fromCharCode(a);\n};\n\nconst chars = {\n nilChar: char(176),\n missingChar: char(201),\n nilPremitive: char(175),\n missingPremitive: char(200),\n\n emptyChar: char(178),\n emptyValue: char(177), //empty Premitive\n\n boundryChar: char(179),\n\n objStart: char(198),\n arrStart: char(204),\n arrayEnd: char(185),\n};\n\nconst charsArr = [\n chars.nilChar,\n chars.nilPremitive,\n chars.missingChar,\n chars.missingPremitive,\n chars.boundryChar,\n chars.emptyChar,\n chars.emptyValue,\n chars.arrayEnd,\n chars.objStart,\n chars.arrStart,\n];\n\nconst _e = function(node, e_schema, options) {\n if (typeof e_schema === 'string') {\n //premitive\n if (node && node[0] && node[0].val !== undefined) {\n return getValue(node[0].val, e_schema);\n } else {\n return getValue(node, e_schema);\n }\n } else {\n const hasValidData = hasData(node);\n if (hasValidData === true) {\n let str = '';\n if (Array.isArray(e_schema)) {\n //attributes can't be repeated. hence check in children tags only\n str += chars.arrStart;\n const itemSchema = e_schema[0];\n //var itemSchemaType = itemSchema;\n const arr_len = node.length;\n\n if (typeof itemSchema === 'string') {\n for (let arr_i = 0; arr_i < arr_len; arr_i++) {\n const r = getValue(node[arr_i].val, itemSchema);\n str = processValue(str, r);\n }\n } else {\n for (let arr_i = 0; arr_i < arr_len; arr_i++) {\n const r = _e(node[arr_i], itemSchema, options);\n str = processValue(str, r);\n }\n }\n str += chars.arrayEnd; //indicates that next item is not array item\n } else {\n //object\n str += chars.objStart;\n const keys = Object.keys(e_schema);\n if (Array.isArray(node)) {\n node = node[0];\n }\n for (let i in keys) {\n const key = keys[i];\n //a property defined in schema can be present either in attrsMap or children tags\n //options.textNodeName will not present in both maps, take it's value from val\n //options.attrNodeName will be present in attrsMap\n let r;\n if (!options.ignoreAttributes && node.attrsMap && node.attrsMap[key]) {\n r = _e(node.attrsMap[key], e_schema[key], options);\n } else if (key === options.textNodeName) {\n r = _e(node.val, e_schema[key], options);\n } else {\n r = _e(node.child[key], e_schema[key], options);\n }\n str = processValue(str, r);\n }\n }\n return str;\n } else {\n return hasValidData;\n }\n }\n};\n\nconst getValue = function(a /*, type*/) {\n switch (a) {\n case undefined:\n return chars.missingPremitive;\n case null:\n return chars.nilPremitive;\n case '':\n return chars.emptyValue;\n default:\n return a;\n }\n};\n\nconst processValue = function(str, r) {\n if (!isAppChar(r[0]) && !isAppChar(str[str.length - 1])) {\n str += chars.boundryChar;\n }\n return str + r;\n};\n\nconst isAppChar = function(ch) {\n return charsArr.indexOf(ch) !== -1;\n};\n\nfunction hasData(jObj) {\n if (jObj === undefined) {\n return chars.missingChar;\n } else if (jObj === null) {\n return chars.nilChar;\n } else if (\n jObj.child &&\n Object.keys(jObj.child).length === 0 &&\n (!jObj.attrsMap || Object.keys(jObj.attrsMap).length === 0)\n ) {\n return chars.emptyChar;\n } else {\n return true;\n }\n}\n\nconst x2j = require('./xmlstr2xmlnode');\nconst buildOptions = require('./util').buildOptions;\n\nconst convert2nimn = function(node, e_schema, options) {\n options = buildOptions(options, x2j.defaultOptions, x2j.props);\n return _e(node, e_schema, options);\n};\n\nexports.convert2nimn = convert2nimn;\n","'use strict';\n\nconst util = require('./util');\nconst buildOptions = require('./util').buildOptions;\nconst x2j = require('./xmlstr2xmlnode');\n\n//TODO: do it later\nconst convertToJsonString = function(node, options) {\n options = buildOptions(options, x2j.defaultOptions, x2j.props);\n\n options.indentBy = options.indentBy || '';\n return _cToJsonStr(node, options, 0);\n};\n\nconst _cToJsonStr = function(node, options, level) {\n let jObj = '{';\n\n //traver through all the children\n const keys = Object.keys(node.child);\n\n for (let index = 0; index < keys.length; index++) {\n var tagname = keys[index];\n if (node.child[tagname] && node.child[tagname].length > 1) {\n jObj += '\"' + tagname + '\" : [ ';\n for (var tag in node.child[tagname]) {\n jObj += _cToJsonStr(node.child[tagname][tag], options) + ' , ';\n }\n jObj = jObj.substr(0, jObj.length - 1) + ' ] '; //remove extra comma in last\n } else {\n jObj += '\"' + tagname + '\" : ' + _cToJsonStr(node.child[tagname][0], options) + ' ,';\n }\n }\n util.merge(jObj, node.attrsMap);\n //add attrsMap as new children\n if (util.isEmptyObject(jObj)) {\n return util.isExist(node.val) ? node.val : '';\n } else {\n if (util.isExist(node.val)) {\n if (!(typeof node.val === 'string' && (node.val === '' || node.val === options.cdataPositionChar))) {\n jObj += '\"' + options.textNodeName + '\" : ' + stringval(node.val);\n }\n }\n }\n //add value\n if (jObj[jObj.length - 1] === ',') {\n jObj = jObj.substr(0, jObj.length - 2);\n }\n return jObj + '}';\n};\n\nfunction stringval(v) {\n if (v === true || v === false || !isNaN(v)) {\n return v;\n } else {\n return '\"' + v + '\"';\n }\n}\n\nfunction indentate(options, level) {\n return options.indentBy.repeat(level);\n}\n\nexports.convertToJsonString = convertToJsonString;\n","'use strict';\n\nconst util = require('./util');\n\nconst defaultOptions = {\n allowBooleanAttributes: false, //A tag can have attributes without any value\n localeRange: 'a-zA-Z',\n};\n\nconst props = ['allowBooleanAttributes', 'localeRange'];\n\n//const tagsPattern = new RegExp(\"<\\\\/?([\\\\w:\\\\-_\\.]+)\\\\s*\\/?>\",\"g\");\nexports.validate = function(xmlData, options) {\n options = util.buildOptions(options, defaultOptions, props);\n\n //xmlData = xmlData.replace(/(\\r\\n|\\n|\\r)/gm,\"\");//make it single line\n //xmlData = xmlData.replace(/(^\\s*<\\?xml.*?\\?>)/g,\"\");//Remove XML starting tag\n //xmlData = xmlData.replace(/()/g,\"\");//Remove DOCTYPE\n\n const tags = [];\n let tagFound = false;\n if (xmlData[0] === '\\ufeff') {\n // check for byte order mark (BOM)\n xmlData = xmlData.substr(1);\n }\n const regxAttrName = new RegExp('^[_w][\\\\w\\\\-.:]*$'.replace('_w', '_' + options.localeRange));\n const regxTagName = new RegExp('^([w]|_)[\\\\w.\\\\-_:]*'.replace('([w', '([' + options.localeRange));\n for (let i = 0; i < xmlData.length; i++) {\n if (xmlData[i] === '<') {\n //starting of tag\n //read until you reach to '>' avoiding any '>' in attribute value\n\n i++;\n if (xmlData[i] === '?') {\n i = readPI(xmlData, ++i);\n if (i.err) {\n return i;\n }\n } else if (xmlData[i] === '!') {\n i = readCommentAndCDATA(xmlData, i);\n continue;\n } else {\n let closingTag = false;\n if (xmlData[i] === '/') {\n //closing tag\n closingTag = true;\n i++;\n }\n //read tagname\n let tagName = '';\n for (\n ;\n i < xmlData.length &&\n xmlData[i] !== '>' &&\n xmlData[i] !== ' ' &&\n xmlData[i] !== '\\t' &&\n xmlData[i] !== '\\n' &&\n xmlData[i] !== '\\r';\n i++\n ) {\n tagName += xmlData[i];\n }\n tagName = tagName.trim();\n //console.log(tagName);\n\n if (tagName[tagName.length - 1] === '/') {\n //self closing tag without attributes\n tagName = tagName.substring(0, tagName.length - 1);\n continue;\n }\n if (!validateTagName(tagName, regxTagName)) {\n return {err: {code: 'InvalidTag', msg: 'Tag ' + tagName + ' is an invalid name.'}};\n }\n\n const result = readAttributeStr(xmlData, i);\n if (result === false) {\n return {err: {code: 'InvalidAttr', msg: 'Attributes for \"' + tagName + '\" have open quote.'}};\n }\n let attrStr = result.value;\n i = result.index;\n\n if (attrStr[attrStr.length - 1] === '/') {\n //self closing tag\n attrStr = attrStr.substring(0, attrStr.length - 1);\n const isValid = validateAttributeString(attrStr, options, regxAttrName);\n if (isValid === true) {\n tagFound = true;\n //continue; //text may presents after self closing tag\n } else {\n return isValid;\n }\n } else if (closingTag) {\n if(!result.tagClosed){\n return {\n err: {code: 'InvalidTag', msg: 'closing tag \"' + tagName + \"\\\" don't have proper closing.\"},\n };\n }else if (attrStr.trim().length > 0) {\n return {\n err: {code: 'InvalidTag', msg: 'closing tag \"' + tagName + \"\\\" can't have attributes or invalid starting.\"},\n };\n } else {\n const otg = tags.pop();\n if (tagName !== otg) {\n return {\n err: {code: 'InvalidTag', msg: 'closing tag ' + otg + ' is expected inplace of ' + tagName + '.'},\n };\n }\n }\n } else {\n const isValid = validateAttributeString(attrStr, options, regxAttrName);\n if (isValid !== true) {\n return isValid;\n }\n tags.push(tagName);\n tagFound = true;\n }\n\n //skip tag text value\n //It may include comments and CDATA value\n for (i++; i < xmlData.length; i++) {\n if (xmlData[i] === '<') {\n if (xmlData[i + 1] === '!') {\n //comment or CADATA\n i++;\n i = readCommentAndCDATA(xmlData, i);\n continue;\n } else {\n break;\n }\n }\n } //end of reading tag text value\n if (xmlData[i] === '<') {\n i--;\n }\n }\n } else {\n if (xmlData[i] === ' ' || xmlData[i] === '\\t' || xmlData[i] === '\\n' || xmlData[i] === '\\r') {\n continue;\n }\n return {err: {code: 'InvalidChar', msg: 'char ' + xmlData[i] + ' is not expected .'}};\n }\n }\n\n if (!tagFound) {\n return {err: {code: 'InvalidXml', msg: 'Start tag expected.'}};\n } else if (tags.length > 0) {\n return {\n err: {code: 'InvalidXml', msg: 'Invalid ' + JSON.stringify(tags, null, 4).replace(/\\r?\\n/g, '') + ' found.'},\n };\n }\n\n return true;\n};\n\n/**\n * Read Processing insstructions and skip\n * @param {*} xmlData\n * @param {*} i\n */\nfunction readPI(xmlData, i) {\n var start = i;\n for (; i < xmlData.length; i++) {\n if (xmlData[i] == '?' || xmlData[i] == ' ') {\n //tagname\n var tagname = xmlData.substr(start, i - start);\n if (i > 5 && tagname === 'xml') {\n return {err: {code: 'InvalidXml', msg: 'XML declaration allowed only at the start of the document.'}};\n } else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {\n //check if valid attribut string\n i++;\n break;\n } else {\n continue;\n }\n }\n }\n return i;\n}\n\nfunction readCommentAndCDATA(xmlData, i) {\n if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') {\n //comment\n for (i += 3; i < xmlData.length; i++) {\n if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') {\n i += 2;\n break;\n }\n }\n } else if (\n xmlData.length > i + 8 &&\n xmlData[i + 1] === 'D' &&\n xmlData[i + 2] === 'O' &&\n xmlData[i + 3] === 'C' &&\n xmlData[i + 4] === 'T' &&\n xmlData[i + 5] === 'Y' &&\n xmlData[i + 6] === 'P' &&\n xmlData[i + 7] === 'E'\n ) {\n let angleBracketsCount = 1;\n for (i += 8; i < xmlData.length; i++) {\n if (xmlData[i] === '<') {\n angleBracketsCount++;\n } else if (xmlData[i] === '>') {\n angleBracketsCount--;\n if (angleBracketsCount === 0) {\n break;\n }\n }\n }\n } else if (\n xmlData.length > i + 9 &&\n xmlData[i + 1] === '[' &&\n xmlData[i + 2] === 'C' &&\n xmlData[i + 3] === 'D' &&\n xmlData[i + 4] === 'A' &&\n xmlData[i + 5] === 'T' &&\n xmlData[i + 6] === 'A' &&\n xmlData[i + 7] === '['\n ) {\n for (i += 8; i < xmlData.length; i++) {\n if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') {\n i += 2;\n break;\n }\n }\n }\n\n return i;\n}\n\nvar doubleQuote = '\"';\nvar singleQuote = \"'\";\n\n/**\n * Keep reading xmlData until '<' is found outside the attribute value.\n * @param {string} xmlData\n * @param {number} i\n */\nfunction readAttributeStr(xmlData, i) {\n let attrStr = '';\n let startChar = '';\n let tagClosed = false;\n for (; i < xmlData.length; i++) {\n if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {\n if (startChar === '') {\n startChar = xmlData[i];\n } else if (startChar !== xmlData[i]) {\n //if vaue is enclosed with double quote then single quotes are allowed inside the value and vice versa\n continue;\n } else {\n startChar = '';\n }\n } else if (xmlData[i] === '>') {\n if (startChar === '') {\n tagClosed = true;\n break;\n }\n }\n attrStr += xmlData[i];\n }\n if (startChar !== '') {\n return false;\n }\n\n return {value: attrStr, index: i, tagClosed: tagClosed};\n}\n\n/**\n * Select all the attributes whether valid or invalid.\n */\nconst validAttrStrRegxp = new RegExp('(\\\\s*)([^\\\\s=]+)(\\\\s*=)?(\\\\s*([\\'\"])(([\\\\s\\\\S])*?)\\\\5)?', 'g');\n\n//attr, =\"sd\", a=\"amit's\", a=\"sd\"b=\"saf\", ab cd=\"\"\n\nfunction validateAttributeString(attrStr, options, regxAttrName) {\n //console.log(\"start:\"+attrStr+\":end\");\n\n //if(attrStr.trim().length === 0) return true; //empty string\n\n const matches = util.getAllMatches(attrStr, validAttrStrRegxp);\n const attrNames = {};\n\n for (let i = 0; i < matches.length; i++) {\n //console.log(matches[i]);\n\n if (matches[i][1].length === 0) {\n //nospace before attribute name: a=\"sd\"b=\"saf\"\n return {err: {code: 'InvalidAttr', msg: 'attribute ' + matches[i][2] + ' has no space in starting.'}};\n } else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {\n //independent attribute: ab\n return {err: {code: 'InvalidAttr', msg: 'boolean attribute ' + matches[i][2] + ' is not allowed.'}};\n }\n /* else if(matches[i][6] === undefined){//attribute without value: ab=\n return { err: { code:\"InvalidAttr\",msg:\"attribute \" + matches[i][2] + \" has no value assigned.\"}};\n } */\n const attrName = matches[i][2];\n if (!validateAttrName(attrName, regxAttrName)) {\n return {err: {code: 'InvalidAttr', msg: 'attribute ' + attrName + ' is an invalid name.'}};\n }\n if (!attrNames.hasOwnProperty(attrName)) {\n //check for duplicate attribute.\n attrNames[attrName] = 1;\n } else {\n return {err: {code: 'InvalidAttr', msg: 'attribute ' + attrName + ' is repeated.'}};\n }\n }\n\n return true;\n}\n\n// const validAttrRegxp = /^[_a-zA-Z][\\w\\-.:]*$/;\n\nfunction validateAttrName(attrName, regxAttrName) {\n // const validAttrRegxp = new RegExp(regxAttrName);\n return util.doesMatch(attrName, regxAttrName);\n}\n\n//const startsWithXML = new RegExp(\"^[Xx][Mm][Ll]\");\n// startsWith = /^([a-zA-Z]|_)[\\w.\\-_:]*/;\n\nfunction validateTagName(tagname, regxTagName) {\n /*if(util.doesMatch(tagname,startsWithXML)) return false;\n else*/\n return !util.doesNotMatch(tagname, regxTagName);\n}\n","'use strict';\n//parse Empty Node as self closing node\nconst buildOptions = require('./util').buildOptions;\n\nconst defaultOptions = {\n attributeNamePrefix: '@_',\n attrNodeName: false,\n textNodeName: '#text',\n ignoreAttributes: true,\n cdataTagName: false,\n cdataPositionChar: '\\\\c',\n format: false,\n indentBy: ' ',\n supressEmptyNode: false,\n tagValueProcessor: function(a) {\n return a;\n },\n attrValueProcessor: function(a) {\n return a;\n },\n};\n\nconst props = [\n 'attributeNamePrefix',\n 'attrNodeName',\n 'textNodeName',\n 'ignoreAttributes',\n 'cdataTagName',\n 'cdataPositionChar',\n 'format',\n 'indentBy',\n 'supressEmptyNode',\n 'tagValueProcessor',\n 'attrValueProcessor',\n];\n\nfunction Parser(options) {\n this.options = buildOptions(options, defaultOptions, props);\n if (this.options.ignoreAttributes || this.options.attrNodeName) {\n this.isAttribute = function(/*a*/) {\n return false;\n };\n } else {\n this.attrPrefixLen = this.options.attributeNamePrefix.length;\n this.isAttribute = isAttribute;\n }\n if (this.options.cdataTagName) {\n this.isCDATA = isCDATA;\n } else {\n this.isCDATA = function(/*a*/) {\n return false;\n };\n }\n this.replaceCDATAstr = replaceCDATAstr;\n this.replaceCDATAarr = replaceCDATAarr;\n\n if (this.options.format) {\n this.indentate = indentate;\n this.tagEndChar = '>\\n';\n this.newLine = '\\n';\n } else {\n this.indentate = function() {\n return '';\n };\n this.tagEndChar = '>';\n this.newLine = '';\n }\n\n if (this.options.supressEmptyNode) {\n this.buildTextNode = buildEmptyTextNode;\n this.buildObjNode = buildEmptyObjNode;\n } else {\n this.buildTextNode = buildTextValNode;\n this.buildObjNode = buildObjectNode;\n }\n\n this.buildTextValNode = buildTextValNode;\n this.buildObjectNode = buildObjectNode;\n}\n\nParser.prototype.parse = function(jObj) {\n return this.j2x(jObj, 0).val;\n};\n\nParser.prototype.j2x = function(jObj, level) {\n let attrStr = '';\n let val = '';\n const keys = Object.keys(jObj);\n const len = keys.length;\n for (let i = 0; i < len; i++) {\n const key = keys[i];\n if (typeof jObj[key] === 'undefined') {\n // supress undefined node\n } else if (jObj[key] === null) {\n val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n } else if (jObj[key] instanceof Date) {\n val += this.buildTextNode(jObj[key], key, '', level);\n } else if (typeof jObj[key] !== 'object') {\n //premitive type\n const attr = this.isAttribute(key);\n if (attr) {\n attrStr += ' ' + attr + '=\"' + this.options.attrValueProcessor('' + jObj[key]) + '\"';\n } else if (this.isCDATA(key)) {\n if (jObj[this.options.textNodeName]) {\n val += this.replaceCDATAstr(jObj[this.options.textNodeName], jObj[key]);\n } else {\n val += this.replaceCDATAstr('', jObj[key]);\n }\n } else {\n //tag value\n if (key === this.options.textNodeName) {\n if (jObj[this.options.cdataTagName]) {\n //value will added while processing cdata\n } else {\n val += this.options.tagValueProcessor('' + jObj[key]);\n }\n } else {\n val += this.buildTextNode(jObj[key], key, '', level);\n }\n }\n } else if (Array.isArray(jObj[key])) {\n //repeated nodes\n if (this.isCDATA(key)) {\n val += this.indentate(level);\n if (jObj[this.options.textNodeName]) {\n val += this.replaceCDATAarr(jObj[this.options.textNodeName], jObj[key]);\n } else {\n val += this.replaceCDATAarr('', jObj[key]);\n }\n } else {\n //nested nodes\n const arrLen = jObj[key].length;\n for (let j = 0; j < arrLen; j++) {\n const item = jObj[key][j];\n if (typeof item === 'undefined') {\n // supress undefined node\n } else if (item === null) {\n val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n } else if (typeof item === 'object') {\n const result = this.j2x(item, level + 1);\n val += this.buildObjNode(result.val, key, result.attrStr, level);\n } else {\n val += this.buildTextNode(item, key, '', level);\n }\n }\n }\n } else {\n //nested node\n if (this.options.attrNodeName && key === this.options.attrNodeName) {\n const Ks = Object.keys(jObj[key]);\n const L = Ks.length;\n for (let j = 0; j < L; j++) {\n attrStr += ' ' + Ks[j] + '=\"' + this.options.attrValueProcessor('' + jObj[key][Ks[j]]) + '\"';\n }\n } else {\n const result = this.j2x(jObj[key], level + 1);\n val += this.buildObjNode(result.val, key, result.attrStr, level);\n }\n }\n }\n return {attrStr: attrStr, val: val};\n};\n\nfunction replaceCDATAstr(str, cdata) {\n str = this.options.tagValueProcessor('' + str);\n if (this.options.cdataPositionChar === '' || str === '') {\n return str + '');\n }\n return str + this.newLine;\n }\n}\n\nfunction buildObjectNode(val, key, attrStr, level) {\n if (attrStr && !val.includes('<')) {\n return (\n this.indentate(level) +\n '<' +\n key +\n attrStr +\n '>' +\n val +\n //+ this.newLine\n // + this.indentate(level)\n '' +\n this.options.tagValueProcessor(val) +\n '