You've already forked setup-dotnet
mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-07-17 04:20:34 +07:00
Update node modules
This commit is contained in:
1
node_modules/fast-xml-parser/BACKERS.md
generated
vendored
1
node_modules/fast-xml-parser/BACKERS.md
generated
vendored
@ -1 +0,0 @@
|
||||
|
274
node_modules/fast-xml-parser/CHANGELOG.md
generated
vendored
274
node_modules/fast-xml-parser/CHANGELOG.md
generated
vendored
@ -1,274 +0,0 @@
|
||||
3.12.20 / 2019-08-16
|
||||
* Revert: Fix #167: '>' in attribute value as it is causing high performance degrade.
|
||||
3.12.19 / 2019-07-28
|
||||
* Fix js to xml parser should work for date values. (broken: `tagValueProcessor` will receive the original value instead of string always) (breaking change)
|
||||
3.12.18 / 2019-07-27
|
||||
* remove configstore dependency
|
||||
3.12.17 / 2019-07-14
|
||||
* Fix #167: '>' in attribute value
|
||||
3.12.16 / 2019-03-23
|
||||
* Support a new option "stopNodes". (#150)
|
||||
|
||||
Accept the list of tags which are not required to be parsed. Instead, all the nested tag and data will be assigned as string.
|
||||
* Don't show post-install message
|
||||
3.12.12 / 2019-01-11
|
||||
* fix : IE parseInt, parseFloat error
|
||||
3.12.11 / 2018-12-24
|
||||
* fix #132: "/" should not be parsed as boolean attr in case of self closing tags
|
||||
3.12.9 / 2018-11-23
|
||||
* fix #129 : validator should not fail when an atrribute name is 'length'
|
||||
3.12.8 / 2018-11-22
|
||||
* fix #128 : use 'attrValueProcessor' to process attribute value in json2xml parser
|
||||
3.12.6 / 2018-11-10
|
||||
* Fix #126: check for type
|
||||
3.12.4 / 2018-09-12
|
||||
* Fix: include tasks in npm package
|
||||
3.12.3 / 2018-09-12
|
||||
* Fix CLI issue raised in last PR
|
||||
3.12.2 / 2018-09-11
|
||||
* Fix formatting for JSON to XML output
|
||||
* Migrate to webpack (PR merged)
|
||||
* fix cli (PR merged)
|
||||
3.12.0 / 2018-08-06
|
||||
* Support hexadecimal values
|
||||
* Support true number parsing
|
||||
3.11.2 / 2018-07-23
|
||||
* Update Demo for more options
|
||||
* Update license information
|
||||
* Update readme for formatting, users, and spelling mistakes
|
||||
* Add missing typescript definition for j2xParser
|
||||
* refactoring: change filenames
|
||||
3.11.1 / 2018-06-05
|
||||
* fix #93: read the text after self closing tag
|
||||
3.11.0 / 2018-05-20
|
||||
* return defaultOptions if there are not options in buildOptions function
|
||||
* added localeRange declaration in parser.d.ts
|
||||
* Added support of cyrillic characters in validator XML
|
||||
* fixed bug in validator work when XML data with byte order marker
|
||||
3.10.0 / 2018-05-13
|
||||
* Added support of cyrillic characters in parsing XML to JSON
|
||||
3.9.11 / 2018-05-09
|
||||
* fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/80 fix nimn chars
|
||||
* update package information
|
||||
* fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/86: json 2 xml parser : property with null value should be parsed to self closing tag.
|
||||
* update online demo
|
||||
* revert zombiejs to old version to support old version of node
|
||||
* update dependencies
|
||||
3.3.10 / 2018-04-23
|
||||
* fix #77 : parse even if closing tag has space before '>'
|
||||
* include all css & js lib in demo app
|
||||
* remove babel dependencies until needed
|
||||
3.3.9 / 2018-04-18
|
||||
* fix #74 : TS2314 TypeScript compiler error
|
||||
3.3.8 / 2018-04-17
|
||||
* fix #73 : IE doesn't support Object.assign
|
||||
3.3.7 / 2018-04-14
|
||||
* fix: use let insted of const in for loop of validator
|
||||
* Merge pull request
|
||||
https://github.com/NaturalIntelligence/fast-xml-parser/issues/71 from bb/master
|
||||
first draft of typings for typescript
|
||||
https://github.com/NaturalIntelligence/fast-xml-parser/issues/69
|
||||
* Merge pull request
|
||||
https://github.com/NaturalIntelligence/fast-xml-parser/issues/70 from bb/patch-1
|
||||
fix some typos in readme
|
||||
3.3.6 / 2018-03-21
|
||||
* change arrow functions to full notation for IE compatibility
|
||||
3.3.5 / 2018-03-15
|
||||
* fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/67 : attrNodeName invalid behavior
|
||||
* fix: remove decodeHTML char condition
|
||||
3.3.4 / 2018-03-14
|
||||
* remove dependency on "he" package
|
||||
* refactor code to separate methods in separate files.
|
||||
* draft code for transforming XML to json string. It is not officially documented due to performance issue.
|
||||
3.3.0 / 2018-03-05
|
||||
* use common default options for XML parsing for consistency. And add `parseToNimn` method.
|
||||
* update nexttodo
|
||||
* update README about XML to Nimn transformation and remove special notes about 3.x release
|
||||
* update CONTRIBUTING.ms mentioning nexttodo
|
||||
* add negative case for XML PIs
|
||||
* validate xml processing instruction tags https://github.com/NaturalIntelligence/fast-xml-parser/issues/62
|
||||
* nimndata: handle array with object
|
||||
* nimndata: node with nested node and text node
|
||||
* nimndata: handle attributes and text node
|
||||
* nimndata: add options, handle array
|
||||
* add xml to nimn data converter
|
||||
* x2j: direct access property with tagname
|
||||
* update changelog
|
||||
* fix validator when single quote presents in value enclosed with double quotes or vice versa
|
||||
* Revert "remove unneded nimnjs dependency, move opencollective to devDependencies and replace it
|
||||
with more light opencollective-postinstall"
|
||||
This reverts commit d47aa7181075d82db4fee97fd8ea32b056fe3f46.
|
||||
* Merge pull request: https://github.com/NaturalIntelligence/fast-xml-parser/issues/63 from HaroldPutman/suppress-undefined
|
||||
Keep undefined nodes out of the XML output : This is useful when you are deleting nodes from the JSON and rewriting XML.
|
||||
3.2.4 / 2018-03-01
|
||||
* fix #59 fix in validator when open quote presents in attribute value
|
||||
* Create nexttodo.md
|
||||
* exclude static from bitHound tests
|
||||
* add package lock
|
||||
3.2.3 / 2018-02-28
|
||||
* Merge pull request from Delagen/master: fix namespaces can contain the same characters as xml names
|
||||
3.2.2 / 2018-02-22
|
||||
* fix: attribute xmlns should not be removed if ignoreNameSpace is false
|
||||
* create CONTRIBUTING.md
|
||||
3.2.1 / 2018-02-17
|
||||
* fix: empty attribute should be parsed
|
||||
3.2.0 / 2018-02-16
|
||||
* Merge pull request : Dev to Master
|
||||
* Update README and version
|
||||
* j2x:add performance test
|
||||
* j2x: Remove extra empty line before closing tag
|
||||
* j2x: suppress empty nodes to self closing node if configured
|
||||
* j2x: provide option to give indentation depth
|
||||
* j2x: make optional formatting
|
||||
* j2x: encodeHTMLchat
|
||||
* j2x: handle cdata tag
|
||||
* j2x: handle grouped attributes
|
||||
* convert json to xml
|
||||
- nested object
|
||||
- array
|
||||
- attributes
|
||||
- text value
|
||||
* small refactoring
|
||||
* Merge pull request: Update cli.js to let user validate XML file or data
|
||||
* Add option for rendering CDATA as separate property
|
||||
3.0.1 / 2018-02-09
|
||||
* fix CRLF: replace it with single space in attributes value only.
|
||||
3.0.0 / 2018-02-08
|
||||
* change online tool with new changes
|
||||
* update info about new options
|
||||
* separate tag value processing to separate function
|
||||
* make HTML decoding optional
|
||||
* give an option to allow boolean attributes
|
||||
* change cli options as per v3
|
||||
* Correct comparison table format on README
|
||||
* update v3 information
|
||||
* some performance improvement changes
|
||||
* Make regex object local to the method and move some common methods to util
|
||||
* Change parser to
|
||||
- handle multiple instances of CDATA
|
||||
- make triming of value optionals
|
||||
- HTML decode attribute and text value
|
||||
- refactor code to separate files
|
||||
* Ignore newline chars without RE (in validator)
|
||||
* validate for XML prolog
|
||||
* Validate DOCTYPE without RE
|
||||
* Update validator to return error response
|
||||
* Update README to add detail about V3
|
||||
* Separate xmlNode model class
|
||||
* include vscode debug config
|
||||
* fix for repeated object
|
||||
* fix attribute regex for boolean attributes
|
||||
* Fix validator for invalid attributes
|
||||
2.9.4 / 2018-02-02
|
||||
* Merge pull request: Decode HTML characters
|
||||
* refactor source folder name
|
||||
* ignore bundle / browser js to be published to npm
|
||||
2.9.3 / 2018-01-26
|
||||
* Merge pull request: Correctly remove CRLF line breaks
|
||||
* Enable to parse attribute in online editor
|
||||
* Fix testing demo app test
|
||||
* Describe parsing options
|
||||
* Add options for online demo
|
||||
2.9.2 / 2018-01-18
|
||||
* Remove check if tag starting with "XML"
|
||||
* Fix: when there are spaces before / after CDATA
|
||||
|
||||
2.9.1 / 2018-01-16
|
||||
* Fix: newline should be replaced with single space
|
||||
* Fix: for single and multiline comments
|
||||
* validate xml with CDATA
|
||||
* Fix: the issue when there is no space between 2 attributes
|
||||
* Fix: https://github.com/NaturalIntelligence/fast-xml-parser/issues/33: when there is newline char in attr val, it doesn't parse
|
||||
* Merge pull request: fix ignoreNamespace
|
||||
* fix: don't wrap attributes if only namespace attrs
|
||||
* fix: use portfinder for run tests, update deps
|
||||
* fix: don't treat namespaces as attributes when ignoreNamespace enabled
|
||||
|
||||
2.9.0 / 2018-01-10
|
||||
* Rewrite the validator to handle large files.
|
||||
Ignore DOCTYPE validation.
|
||||
* Fix: When attribute value has equal sign
|
||||
|
||||
2.8.3 / 2017-12-15
|
||||
* Fix: when a tag has value along with subtags
|
||||
|
||||
2.8.2 / 2017-12-04
|
||||
* Fix value parsing for IE
|
||||
|
||||
2.8.1 / 2017-12-01
|
||||
* fix: validator should return false instead of err when invalid XML
|
||||
|
||||
2.8.0 / 2017-11-29
|
||||
* Add CLI option to ignore value conversion
|
||||
* Fix variable name when filename is given on CLI
|
||||
* Update CLI help text
|
||||
* Merge pull request: xml2js: Accept standard input
|
||||
* Test Node 8
|
||||
* Update dependencies
|
||||
* Bundle readToEnd
|
||||
* Add ability to read from standard input
|
||||
|
||||
2.7.4 / 2017-09-22
|
||||
* Merge pull request: Allow wrap attributes with subobject to compatible with other parsers output
|
||||
|
||||
2.7.3 / 2017-08-02
|
||||
* fix: handle CDATA with regx
|
||||
|
||||
2.7.2 / 2017-07-30
|
||||
* Change travis config for yarn caching
|
||||
* fix validator: when tag property is same as array property
|
||||
* Merge pull request: Failing test case in validator for valid SVG
|
||||
|
||||
2.7.1 / 2017-07-26
|
||||
* Fix: Handle val 0
|
||||
|
||||
2.7.0 / 2017-07-25
|
||||
* Fix test for arrayMode
|
||||
* Merge pull request: Add arrayMode option to parse any nodes as arrays
|
||||
|
||||
2.6.0 / 2017-07-14
|
||||
* code improvement
|
||||
* Add unit tests for value conversion for attr
|
||||
* Merge pull request: option of an attribute value conversion to a number (textAttrConversion) the same way as the textNodeConversion option does. Default value is false.
|
||||
|
||||
2.5.1 / 2017-07-01
|
||||
* Fix XML element name pattern
|
||||
* Fix XML element name pattern while parsing
|
||||
* Fix validation for xml tag element
|
||||
|
||||
2.5.0 / 2017-06-25
|
||||
* Improve Validator performance
|
||||
* update attr matching regex
|
||||
* Add perf tests
|
||||
* Improve atrr regex to handle all cases
|
||||
|
||||
2.4.4 / 2017-06-08
|
||||
* Bug fix: when an attribute has single or double quote in value
|
||||
|
||||
2.4.3 / 2017-06-05
|
||||
* Bug fix: when multiple CDATA tags are given
|
||||
* Merge pull request: add option "textNodeConversion"
|
||||
* add option "textNodeConversion"
|
||||
|
||||
2.4.1 / 2017-04-14
|
||||
* fix tests
|
||||
* Bug fix: preserve initial space of node value
|
||||
* Handle CDATA
|
||||
|
||||
2.3.1 / 2017-03-15
|
||||
* Bug fix: when single self closing tag
|
||||
* Merge pull request: fix .codeclimate.yml
|
||||
* Update .codeclimate.yml - Fixed config so it does not error anymore.
|
||||
* Update .codeclimate.yml
|
||||
|
||||
2.3.0 / 2017-02-26
|
||||
* Code improvement
|
||||
* add bithound config
|
||||
* Update usage
|
||||
* Update travis to generate bundle js before running tests
|
||||
* 1.Browserify, 2. add more tests for validator
|
||||
* Add validator
|
||||
* Fix CLI default parameter bug
|
||||
|
||||
2.2.1 / 2017-02-05
|
||||
* Bug fix: CLI default option
|
46
node_modules/fast-xml-parser/CONTRIBUTING.md
generated
vendored
46
node_modules/fast-xml-parser/CONTRIBUTING.md
generated
vendored
@ -1,46 +0,0 @@
|
||||
# Thanks
|
||||
I would like to thank you for your valuable time and effort and applogies if this PR is rejected due to any reason.
|
||||
|
||||
This repository is written with the aim of providing high performance not in terms of speed only but comfortability of the user as well.
|
||||
|
||||
If your change is not a bug fix please check **nexttodo.md** before implementing any new feature.
|
||||
|
||||
## No rights are resserved
|
||||
|
||||
Your contribution is valuable. We try to mention your name on README with the avatar. We can't promise to pay you for your contribution.
|
||||
|
||||
### DoD
|
||||
Here is the check list to publish any change
|
||||
|
||||
* Changes are not half implemented due to the library limitation or any other reason.
|
||||
* Changes are well discussed by raising github issue. So they are well known by other contributers and users
|
||||
* Echoing the above point. The purpose / goal for the PR should be mentioned in the description.
|
||||
* Multiple unrelated changes should not be clubbed in single PR.
|
||||
* Please run perf tests `node benchmark\perfTest3.js` before and after the changes. And mention it in PR description.
|
||||
* If you are adding any dependency (specially if it is not the dev dependency) please check that
|
||||
* it is not dependent on other language packages like c/c++
|
||||
* the package is not very old, very new, discontinued, or has any vulnerability etc.
|
||||
* please check the performance and size of package
|
||||
* please check alternate available options
|
||||
* Please write tests for the new changes
|
||||
* Don't forget to write tests for negative cases
|
||||
* Don't comment existing test case.
|
||||
|
||||
Changes need to do be done by owner
|
||||
* Increase the version number
|
||||
* Update the change log & README if required
|
||||
* Generate the browser bundle
|
||||
* Release in github and publish to npm
|
||||
|
||||
Note that publishing changes or accepting any PR may take time. So please keep patience.
|
||||
|
||||
### Guidelines for first time contributors
|
||||
|
||||
* https://github.com/Roshanjossey/first-contributions
|
||||
* **Don't stretch**. If you complete an issue in long time, there is a possibility that other developers finish their part and you face code conflicts which may increase code complexity for you. So it is always good to complete an issue ASAP.
|
||||
* Please refrain to work on multiple issues marked with "first-timers-only" in the same repo. Ask and help your friends and colleagues to attempt rest issues.
|
||||
* Please claim the issue and clear your doubts before raising PR. So other users will not start working on the same issue.
|
||||
* Mention the issue number either in PR detail or in commit message.
|
||||
* Keep increasing the level of challenge.
|
||||
* Don't hesitate to question on github issue or on twitter.
|
||||
|
51
node_modules/fast-xml-parser/README.md
generated
vendored
51
node_modules/fast-xml-parser/README.md
generated
vendored
@ -25,32 +25,42 @@ List of some applications/projects using Fast XML Parser. (Raise an issue to sub
|
||||
<a href="https://www.atomist.com/" title="Atomist" > <img src="https://avatars3.githubusercontent.com/u/19392" width="80px" ></a>
|
||||
<a href="http://www.opuscapita.com/" title="OpusCapita" > <img src="https://avatars1.githubusercontent.com/u/23256480" width="80px" ></a>
|
||||
<a href="https://nevatrip.ru/" title="nevatrip" > <img src="https://avatars2.githubusercontent.com/u/35730984" width="80px" ></a>
|
||||
<a href="http://www.smartbear.com" title="SmartBear Software" > <img src="https://avatars2.githubusercontent.com/u/1644671" width="80px" ></a>
|
||||
<a href="http://eosnavigator.com/" title="nevatrip" > <img src="https://avatars1.githubusercontent.com/u/40260563" width="80px" ></a>
|
||||
<a href="http://pds.nasa.gov/" title="NASA-PDS" > <img src="https://avatars2.githubusercontent.com/u/26313833" width="80px" ></a>
|
||||
<a href="http://nasa.github.io/" title="NASA" > <img src="https://avatars0.githubusercontent.com/u/848102" width="80px" ></a>
|
||||
<a href="http://qgis.org/" title="QGIS" > <img src="https://avatars2.githubusercontent.com/u/483444" width="80px" ></a>
|
||||
<a href="http://www.craft.ai/" title="craft ai" > <img src="https://avatars1.githubusercontent.com/u/12046764" width="80px" ></a>
|
||||
<a href="http://brownspace.org/" title="Brown Space Engineering" > <img src="https://avatars2.githubusercontent.com/u/5504507" width="80px" ></a>
|
||||
<a href="http://www.appcelerator.com/" title="Team Appcelerator" > <img src="https://avatars1.githubusercontent.com/u/82188" width="80px" ></a>
|
||||
<a href="https://xmllint.com/" title="XML Lint" > <img src="https://xmllint.com/assets/logo.png" width="80px" ></a>
|
||||
<a href="https://github.com/prettier" title="Prettier" > <img src="https://avatars0.githubusercontent.com/u/25822731" width="80px" ></a>
|
||||
<a href="https://github.com/dolanmiu/docx" title="docx" > <img src="https://i.imgur.com/37uBGhO.gif" width="80px" ></a>
|
||||
<a href="http://orange-opensource.github.io/" title="Open Source by Orange" > <img src="https://avatars3.githubusercontent.com/u/1506386" width="80px" ></a>
|
||||
<a href="http://www.ybrain.com/" title="YBRAIN Inc." > <img src="https://avatars2.githubusercontent.com/u/38232440" width="80px" ></a>
|
||||
<a href="http://99bitcoins.com/" title="99 bitcoins" > <img src="https://avatars0.githubusercontent.com/u/9527779" width="80px" ></a>
|
||||
<a href="https://wechaty.github.io/wechaty/" title="Wechaty" > <img src="https://avatars0.githubusercontent.com/u/21285357" width="80px" ></a>
|
||||
<a href="https://opendatakit.org" title="Open Data Kit" > <img src="https://avatars0.githubusercontent.com/u/6222985" width="80px" ></a>
|
||||
<a href="https://ridibooks.com" title="RIDI Books" > <img src="https://avatars1.githubusercontent.com/u/24955411" width="80px" ></a>
|
||||
<a href="http://signalk.org" title="Signal K" > <img src="https://avatars1.githubusercontent.com/u/7126740" width="80px" ></a>
|
||||
<a href="http://brain.js.org/" title="brain.js" > <img src="https://avatars2.githubusercontent.com/u/23732838" width="80px" ></a>
|
||||
<a href="https://skygear.io/" title="Skegear" > <img src="https://avatars1.githubusercontent.com/u/15025887" width="80px" ></a>
|
||||
<a href="https://npmjs.com/" title="npm" > <img src="https://avatars0.githubusercontent.com/u/6078720" width="80px" ></a>
|
||||
<a href=" https://www.mindpointgroup.com" title="mindpointgroup" > <img src="https://avatars1.githubusercontent.com/u/6413533" width="80px" ></a>
|
||||
<a href="http://www.acuantcorp.com/" title="Acuant Inc" > <img src="https://avatars3.githubusercontent.com/u/11580319?s=200&v=4" width="80px" ></a>
|
||||
<a href="https://www.wazuh.com/" title="wazuh" > <img src="https://avatars2.githubusercontent.com/u/13752566" width="80px" ></a>
|
||||
<a href="https://orbs.com/" title="ORBS The Hybrid Blockchain" > <img src="https://avatars1.githubusercontent.com/u/33665977" width="80px" ></a>
|
||||
<a href="https://texlab.netlify.com/" title="latex-lsp" > <img src="https://avatars1.githubusercontent.com/u/48360002" width="80px" ></a>
|
||||
<a href="https://frontside.io/" title="The Frontside " > <img src="https://avatars1.githubusercontent.com/u/223096" width="80px" ></a>
|
||||
<a href="https://creditsense.com.au/" title="Credit Sense Australia " > <img src="https://avatars0.githubusercontent.com/u/46947118" width="80px" ></a>
|
||||
<a href="https://www.hustunique.com/" title="UniqueStudio" > <img src="https://avatars1.githubusercontent.com/u/4847684" width="80px" ></a>
|
||||
<a href="http://www.openforis.org/" title="Open Foris" > <img src="https://avatars2.githubusercontent.com/u/1212750" width="80px" ></a>
|
||||
<a href="#" title="NHS Connect" > <img src="https://avatars3.githubusercontent.com/u/20316669" width="80px" ></a>
|
||||
<a href="https://tradle.io/" title="Tradle" > <img src="https://avatars2.githubusercontent.com/u/9482126" width="80px" ></a>
|
||||
<a href="http://www.anl.gov/" title="Argonne National Laboratory" > <img src="https://avatars0.githubusercontent.com/u/10468712" width="80px" ></a>
|
||||
<a href="https://simpleicons.org/" title="Simple Icons" > <img src="https://avatars2.githubusercontent.com/u/29872746" width="80px" ></a>
|
||||
<a href="https://stoplight.io/" title="Stoplight" > <img src="https://avatars1.githubusercontent.com/u/10767217" width="80px" ></a>
|
||||
<a href="http://www.fda.gov/" title="Food and Drug Administration " > <img src="https://avatars2.githubusercontent.com/u/6471964" width="80px" ></a>
|
||||
<a href="http://www.magento.com/" title="Magento" > <img src="https://avatars2.githubusercontent.com/u/168457" width="80px" ></a>
|
||||
|
||||
|
||||
|
||||
@ -90,8 +100,6 @@ List of some applications/projects using Fast XML Parser. (Raise an issue to sub
|
||||
* You can remove namespace from tag or attribute name while parsing
|
||||
* It supports boolean attributes, if configured.
|
||||
|
||||
|
||||
|
||||
## How to use
|
||||
|
||||
To use it in **NPM package** install it first
|
||||
@ -129,8 +137,10 @@ var options = {
|
||||
cdataPositionChar: "\\c",
|
||||
localeRange: "", //To support non english character in tag/attribute values.
|
||||
parseTrueNumberOnly: false,
|
||||
attrValueProcessor: a => he.decode(a, {isAttributeValue: true}),//default is a=>a
|
||||
tagValueProcessor : a => he.decode(a) //default is a=>a
|
||||
arrayMode: false, //"strict"
|
||||
attrValueProcessor: (val, attrName) => he.decode(val, {isAttributeValue: true}),//default is a=>a
|
||||
tagValueProcessor : (val, tagName) => he.decode(val), //default is a=>a
|
||||
stopNodes: ["parse-me-as-string"]
|
||||
};
|
||||
|
||||
if( parser.validate(xmlData) === true) { //optional (it'll return an object in case it's not valid)
|
||||
@ -142,6 +152,28 @@ var tObj = parser.getTraversalObj(xmlData,options);
|
||||
var jsonObj = parser.convertToJson(tObj,options);
|
||||
|
||||
```
|
||||
As you can notice in above code, validator is not embeded with in the parser and expected to be called separately. However, you can pass `true` or validation options as 3rd parameter to the parser to trigger validator internally. It is same as above example.
|
||||
|
||||
```js
|
||||
try{
|
||||
var jsonObj = parser.parse(xmlData,options, true);
|
||||
}catch(error){
|
||||
console.log(error.message)
|
||||
}
|
||||
```
|
||||
|
||||
Validator reurns the following object in case of error;
|
||||
```js
|
||||
{
|
||||
err: {
|
||||
code: code,
|
||||
msg: message,
|
||||
line: lineNumber,
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
#### Note: [he](https://www.npmjs.com/package/he) library is used in this example
|
||||
|
||||
<details>
|
||||
@ -160,6 +192,7 @@ var jsonObj = parser.convertToJson(tObj,options);
|
||||
* **cdataPositionChar** : It'll help to covert JSON back to XML without losing CDATA position.
|
||||
* **localeRange**: Parser will accept non-English character in tag or attribute name. Check #87 for more detail. Eg `localeRange: "a-zA-Zа-яёА-ЯЁ"`
|
||||
* **parseTrueNumberOnly**: if true then values like "+123", or "0123" will not be parsed as number.
|
||||
* **arrayMode** : When `false`, a tag with single occurence is parsed as an object but as an array in case of multiple occurences. When `true`, a tag will be parsed as an array always excluding leaf nodes. When `strict`, all the tags will be parsed as array only.
|
||||
* **tagValueProcessor** : Process tag value during transformation. Like HTML decoding, word capitalization, etc. Applicable in case of string only.
|
||||
* **attrValueProcessor** : Process attribute value during transformation. Like HTML decoding, word capitalization, etc. Applicable in case of string only.
|
||||
* **stopNodes** : an array of tag names which are not required to be parsed. Instead their values are parsed as string.
|
||||
@ -274,11 +307,11 @@ With the correct options, you can get the almost original XML without losing any
|
||||
|
||||
### Worth to mention
|
||||
|
||||
- **[BigBit standard)](https://github.com/amitguptagwl/bigbit)** : A standard to reprent any number in the universe in comparitively less space and without precision loss. A standard to save space to represent any text string in comparision of UTF encoding.
|
||||
- **[imglab](https://github.com/NaturalIntelligence/imglab)** : Speedup and simplify image labeling / annotation. Supports multiple formats, one click annotation, easy interface and much more. There are more than 20k images are annotated every month.
|
||||
- **[BigBit standard)](https://github.com/amitguptagwl/bigbit)** : A standard to represent any number in the universe in comparitively less space and without precision loss. A standard to save memory to represent any text string in comparision of UTF encodings.
|
||||
- **[imglab](https://github.com/NaturalIntelligence/imglab)** : Speedup and simplify image labeling / annotation. Supports multiple formats, one click annotation, easy interface and much more. There are more than half million images are being annotated every month using this tool.
|
||||
- [stubmatic](https://github.com/NaturalIntelligence/Stubmatic) : Create fake webservices, DynamoDB or S3 servers, Manage fake/mock stub data, Or fake any HTTP(s) call.
|
||||
- **[अनुमार्गक (anumargak)](https://github.com/NaturalIntelligence/anumargak)** : The fastest and simple router for node js web frameworks with many unique features.
|
||||
- [stubmatic](https://github.com/NaturalIntelligence/Stubmatic) : A stub server to mock behaviour of HTTP(s) / REST / SOAP services, incuding DynamoDB calls. You can also mock binary formats.
|
||||
- [मुनीम (Muneem)](https://github.com/muneem4node/muneem) : A webframework made for all team members. Faster tha fastify, express, koa, hapi and others.
|
||||
- [मुनीम (Muneem)](https://github.com/muneem4node/muneem) : A webframework made for all team members. Fast and Featured.
|
||||
- [शब्दावली (shabdawali)](https://github.com/amitguptagwl/shabdawali) : Amazing human like typing effects beyond your imagination.
|
||||
|
||||
|
||||
|
17
node_modules/fast-xml-parser/codecept.json
generated
vendored
17
node_modules/fast-xml-parser/codecept.json
generated
vendored
@ -1,17 +0,0 @@
|
||||
{
|
||||
"tests": "./spec/*_spec.js",
|
||||
"timeout": 10000,
|
||||
"output": "./output",
|
||||
"helpers": {
|
||||
"WebDriverIO": {
|
||||
"url": "http://localhost",
|
||||
"browser": "chrome"
|
||||
}
|
||||
},
|
||||
"include": {
|
||||
"I": "./steps_file.js"
|
||||
},
|
||||
"bootstrap": false,
|
||||
"mocha": {},
|
||||
"name": "fxp"
|
||||
}
|
8
node_modules/fast-xml-parser/nexttodo.md
generated
vendored
8
node_modules/fast-xml-parser/nexttodo.md
generated
vendored
@ -1,8 +0,0 @@
|
||||
* check test coverage and write necessary tests
|
||||
* validate XML stream data
|
||||
* Fix jTox for json array. Not sure if a bug exist.
|
||||
* generate separate and combined browser bundle for xml -> nimn, xml -> json , json -> xml
|
||||
* Es6 to es5 migration without workaround.
|
||||
* Parse JSON string to XML. Currently it transforms JSON object to XML. Partially done. Need to work on performance.
|
||||
* build properties only once
|
||||
* XML to JSON ML : https://en.wikipedia.org/wiki/JsonML
|
60
node_modules/fast-xml-parser/package.json
generated
vendored
60
node_modules/fast-xml-parser/package.json
generated
vendored
@ -1,32 +1,28 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"fast-xml-parser@3.12.20",
|
||||
"C:\\dev\\repos\\actions\\setup-dotnet"
|
||||
]
|
||||
],
|
||||
"_from": "fast-xml-parser@3.12.20",
|
||||
"_id": "fast-xml-parser@3.12.20",
|
||||
"_from": "fast-xml-parser@3.15.1",
|
||||
"_id": "fast-xml-parser@3.15.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-viadHdefuuqkyJWUhF2r2Ymb5LJ0T7uQhzSRv4OZzYxpoPQnY05KtaX0pLkolabD7tLzIE8q/OytIAEhqPyYbw==",
|
||||
"_integrity": "sha512-MStlD6aNPZCd9msF5wBh2VJ0jAE2zz85ipk+OIPO+pZi64ckY//oGi5kskcTVRj2bMSmBI5F2SY1IGWHWZzbCA==",
|
||||
"_location": "/fast-xml-parser",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "fast-xml-parser@3.12.20",
|
||||
"raw": "fast-xml-parser@3.15.1",
|
||||
"name": "fast-xml-parser",
|
||||
"escapedName": "fast-xml-parser",
|
||||
"rawSpec": "3.12.20",
|
||||
"rawSpec": "3.15.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.12.20"
|
||||
"fetchSpec": "3.15.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-3.12.20.tgz",
|
||||
"_spec": "3.12.20",
|
||||
"_where": "C:\\dev\\repos\\actions\\setup-dotnet",
|
||||
"_resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-3.15.1.tgz",
|
||||
"_shasum": "7299ef53b00d5c0f9809599396a26e6d1af20603",
|
||||
"_spec": "fast-xml-parser@3.15.1",
|
||||
"_where": "C:\\Users\\Stanley\\Projects\\GitHub\\setup-dotnet",
|
||||
"author": {
|
||||
"name": "Amit Gupta",
|
||||
"url": "https://amitkumargupta.work/"
|
||||
@ -37,6 +33,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/NaturalIntelligence/fast-xml-parser/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Alfonso Muñoz-Pomer Fuentes",
|
||||
@ -56,28 +53,25 @@
|
||||
"url": "https://github.com/Tatsh"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"nimnjs": "^1.3.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Validate XML or Parse XML to JS/JSON very fast without C/C++ based libraries",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.4.0",
|
||||
"@babel/plugin-transform-runtime": "^7.4.0",
|
||||
"@babel/preset-env": "^7.4.2",
|
||||
"@babel/register": "^7.4.0",
|
||||
"babel-loader": "^8.0.5",
|
||||
"@babel/core": "^7.7.5",
|
||||
"@babel/plugin-transform-runtime": "^7.7.6",
|
||||
"@babel/preset-env": "^7.7.6",
|
||||
"@babel/register": "^7.7.4",
|
||||
"babel-loader": "^8.0.6",
|
||||
"benchmark": "^2.1.4",
|
||||
"eslint": "^5.15.3",
|
||||
"eslint": "^5.16.0",
|
||||
"he": "^1.2.0",
|
||||
"http-server": "^0.11.1",
|
||||
"istanbul": "^0.4.5",
|
||||
"jasmine": "^3.3.1",
|
||||
"portfinder": "^1.0.20",
|
||||
"prettier": "^1.15.3",
|
||||
"webpack": "^4.29.6",
|
||||
"webpack-cli": "^3.3.0",
|
||||
"xml2js": "^0.4.19",
|
||||
"zombie": "^5.0.8"
|
||||
"jasmine": "^3.5.0",
|
||||
"nimnjs": "^1.3.2",
|
||||
"prettier": "^1.19.1",
|
||||
"publish-please": "^5.5.1",
|
||||
"webpack": "^4.41.2",
|
||||
"webpack-cli": "^3.3.10"
|
||||
},
|
||||
"homepage": "https://github.com/NaturalIntelligence/fast-xml-parser#readme",
|
||||
"keywords": [
|
||||
@ -119,10 +113,12 @@
|
||||
"lint": "eslint src/*.js spec/*.js",
|
||||
"perf": "node ./benchmark/perfTest3.js",
|
||||
"postinstall": "node tasks/postinstall.js || exit 0",
|
||||
"prepublishOnly": "publish-please guard",
|
||||
"prettier": "prettier --write src/**/*.js",
|
||||
"publish-please": "publish-please",
|
||||
"test": "jasmine spec/*spec.js",
|
||||
"unit": "jasmine"
|
||||
},
|
||||
"typings": "src/parser.d.ts",
|
||||
"version": "3.12.20"
|
||||
"version": "3.15.1"
|
||||
}
|
||||
|
20
node_modules/fast-xml-parser/src/node2json.js
generated
vendored
20
node_modules/fast-xml-parser/src/node2json.js
generated
vendored
@ -12,12 +12,16 @@ const convertToJson = function(node, options) {
|
||||
//otherwise create a textnode if node has some text
|
||||
if (util.isExist(node.val)) {
|
||||
if (!(typeof node.val === 'string' && (node.val === '' || node.val === options.cdataPositionChar))) {
|
||||
jObj[options.textNodeName] = node.val;
|
||||
if(options.arrayMode === "strict"){
|
||||
jObj[options.textNodeName] = [ node.val ];
|
||||
}else{
|
||||
jObj[options.textNodeName] = node.val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
util.merge(jObj, node.attrsMap);
|
||||
util.merge(jObj, node.attrsMap, options.arrayMode);
|
||||
|
||||
const keys = Object.keys(node.child);
|
||||
for (let index = 0; index < keys.length; index++) {
|
||||
@ -28,7 +32,17 @@ const convertToJson = function(node, options) {
|
||||
jObj[tagname].push(convertToJson(node.child[tagname][tag], options));
|
||||
}
|
||||
} else {
|
||||
jObj[tagname] = convertToJson(node.child[tagname][0], options);
|
||||
if(options.arrayMode === true){
|
||||
const result = convertToJson(node.child[tagname][0], options)
|
||||
if(typeof result === 'object')
|
||||
jObj[tagname] = [ result ];
|
||||
else
|
||||
jObj[tagname] = result;
|
||||
}else if(options.arrayMode === "strict"){
|
||||
jObj[tagname] = [convertToJson(node.child[tagname][0], options) ];
|
||||
}else{
|
||||
jObj[tagname] = convertToJson(node.child[tagname][0], options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
17
node_modules/fast-xml-parser/src/parser.d.ts
generated
vendored
17
node_modules/fast-xml-parser/src/parser.d.ts
generated
vendored
@ -7,17 +7,22 @@ type X2jOptions = {
|
||||
allowBooleanAttributes: boolean;
|
||||
parseNodeValue: boolean;
|
||||
parseAttributeValue: boolean;
|
||||
arrayMode: boolean;
|
||||
arrayMode: boolean | 'strict';
|
||||
trimValues: boolean;
|
||||
cdataTagName: false | string;
|
||||
cdataPositionChar: string;
|
||||
localeRange: string;
|
||||
parseTrueNumberOnly: boolean;
|
||||
tagValueProcessor: (tagValue: string) => string;
|
||||
attrValueProcessor: (attrValue: string) => string;
|
||||
tagValueProcessor: (tagValue: string, tagName: string) => string;
|
||||
attrValueProcessor: (attrValue: string, attrName: string) => string;
|
||||
stopNodes: string[];
|
||||
};
|
||||
type X2jOptionsOptional = Partial<X2jOptions>;
|
||||
|
||||
type validationOptions = {
|
||||
allowBooleanAttributes: boolean;
|
||||
localeRange: string;
|
||||
};
|
||||
type validationOptionsOptional = Partial<validationOptions>;
|
||||
type J2xOptions = {
|
||||
attributeNamePrefix: string;
|
||||
attrNodeName: false | string;
|
||||
@ -39,7 +44,7 @@ type ValidationError = {
|
||||
err: { code: string; msg: string };
|
||||
};
|
||||
|
||||
export function parse(xmlData: string, options?: X2jOptionsOptional): any;
|
||||
export function parse(xmlData: string, options?: X2jOptionsOptional, validationOptions?: validationOptionsOptional | boolean): any;
|
||||
export function convert2nimn(
|
||||
node: any,
|
||||
e_schema: ESchema,
|
||||
@ -56,7 +61,7 @@ export function convertToJsonString(
|
||||
): string;
|
||||
export function validate(
|
||||
xmlData: string,
|
||||
options?: { allowBooleanAttributes?: boolean }
|
||||
options?: validationOptionsOptional
|
||||
): true | ValidationError;
|
||||
export class j2xParser {
|
||||
constructor(options: J2xOptionsOptional);
|
||||
|
13
node_modules/fast-xml-parser/src/parser.js
generated
vendored
13
node_modules/fast-xml-parser/src/parser.js
generated
vendored
@ -4,8 +4,17 @@ const nodeToJson = require('./node2json');
|
||||
const xmlToNodeobj = require('./xmlstr2xmlnode');
|
||||
const x2xmlnode = require('./xmlstr2xmlnode');
|
||||
const buildOptions = require('./util').buildOptions;
|
||||
const validator = require('./validator');
|
||||
|
||||
exports.parse = function(xmlData, options) {
|
||||
exports.parse = function(xmlData, options, validationOption) {
|
||||
if( validationOption){
|
||||
if(validationOption === true) validationOption = {}
|
||||
|
||||
const result = validator.validate(xmlData, validationOption);
|
||||
if (result !== true) {
|
||||
throw Error( result.err.msg)
|
||||
}
|
||||
}
|
||||
options = buildOptions(options, x2xmlnode.defaultOptions, x2xmlnode.props);
|
||||
return nodeToJson.convertToJson(xmlToNodeobj.getTraversalObj(xmlData, options), options);
|
||||
};
|
||||
@ -13,7 +22,7 @@ exports.convertTonimn = require('../src/nimndata').convert2nimn;
|
||||
exports.getTraversalObj = xmlToNodeobj.getTraversalObj;
|
||||
exports.convertToJson = nodeToJson.convertToJson;
|
||||
exports.convertToJsonString = require('./node2json_str').convertToJsonString;
|
||||
exports.validate = require('./validator').validate;
|
||||
exports.validate = validator.validate;
|
||||
exports.j2xParser = require('./json2xml');
|
||||
exports.parseToNimn = function(xmlData, schema, options) {
|
||||
return exports.convertTonimn(exports.getTraversalObj(xmlData, options), schema, options);
|
||||
|
8
node_modules/fast-xml-parser/src/util.js
generated
vendored
8
node_modules/fast-xml-parser/src/util.js
generated
vendored
@ -37,12 +37,16 @@ exports.isEmptyObject = function(obj) {
|
||||
* @param {*} target
|
||||
* @param {*} a
|
||||
*/
|
||||
exports.merge = function(target, a) {
|
||||
exports.merge = function(target, a, arrayMode) {
|
||||
if (a) {
|
||||
const keys = Object.keys(a); // will return an array of own properties
|
||||
const len = keys.length; //don't make it inline
|
||||
for (let i = 0; i < len; i++) {
|
||||
target[keys[i]] = a[keys[i]];
|
||||
if(arrayMode === 'strict'){
|
||||
target[keys[i]] = [ a[keys[i]] ];
|
||||
}else{
|
||||
target[keys[i]] = a[keys[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
110
node_modules/fast-xml-parser/src/validator.js
generated
vendored
110
node_modules/fast-xml-parser/src/validator.js
generated
vendored
@ -10,21 +10,30 @@ const defaultOptions = {
|
||||
const props = ['allowBooleanAttributes', 'localeRange'];
|
||||
|
||||
//const tagsPattern = new RegExp("<\\/?([\\w:\\-_\.]+)\\s*\/?>","g");
|
||||
exports.validate = function(xmlData, options) {
|
||||
exports.validate = function (xmlData, options) {
|
||||
options = util.buildOptions(options, defaultOptions, props);
|
||||
|
||||
//xmlData = xmlData.replace(/(\r\n|\n|\r)/gm,"");//make it single line
|
||||
//xmlData = xmlData.replace(/(^\s*<\?xml.*?\?>)/g,"");//Remove XML starting tag
|
||||
//xmlData = xmlData.replace(/(<!DOCTYPE[\s\w\"\.\/\-\:]+(\[.*\])*\s*>)/g,"");//Remove DOCTYPE
|
||||
const localRangeRegex = new RegExp(`[${options.localeRange}]`);
|
||||
|
||||
if (localRangeRegex.test("<#$'\"\\\/:0")) {
|
||||
return getErrorObject('InvalidOptions', 'Invalid localeRange', 1);
|
||||
}
|
||||
|
||||
const tags = [];
|
||||
let tagFound = false;
|
||||
|
||||
//indicates that the root tag has been closed (aka. depth 0 has been reached)
|
||||
let reachedRoot = false;
|
||||
|
||||
if (xmlData[0] === '\ufeff') {
|
||||
// check for byte order mark (BOM)
|
||||
xmlData = xmlData.substr(1);
|
||||
}
|
||||
const regxAttrName = new RegExp('^[_w][\\w\\-.:]*$'.replace('_w', '_' + options.localeRange));
|
||||
const regxTagName = new RegExp('^([w]|_)[\\w.\\-_:]*'.replace('([w', '([' + options.localeRange));
|
||||
const regxAttrName = new RegExp(`^[${options.localeRange}_][${options.localeRange}0-9\\-\\.:]*$`);
|
||||
const regxTagName = new RegExp(`^([${options.localeRange}_])[${options.localeRange}0-9\\.\\-_:]*$`);
|
||||
for (let i = 0; i < xmlData.length; i++) {
|
||||
if (xmlData[i] === '<') {
|
||||
//starting of tag
|
||||
@ -66,15 +75,22 @@ exports.validate = function(xmlData, options) {
|
||||
if (tagName[tagName.length - 1] === '/') {
|
||||
//self closing tag without attributes
|
||||
tagName = tagName.substring(0, tagName.length - 1);
|
||||
continue;
|
||||
//continue;
|
||||
i--;
|
||||
}
|
||||
if (!validateTagName(tagName, regxTagName)) {
|
||||
return {err: {code: 'InvalidTag', msg: 'Tag ' + tagName + ' is an invalid name.'}};
|
||||
let msg;
|
||||
if(tagName.trim().length === 0) {
|
||||
msg = "There is an unnecessary space between tag name and backward slash '</ ..'.";
|
||||
}else{
|
||||
msg = `Tag '${tagName}' is an invalid name.`;
|
||||
}
|
||||
return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i));
|
||||
}
|
||||
|
||||
const result = readAttributeStr(xmlData, i);
|
||||
if (result === false) {
|
||||
return {err: {code: 'InvalidAttr', msg: 'Attributes for ' + tagName + ' have open quote'}};
|
||||
return getErrorObject('InvalidAttr', `Attributes for '${tagName}' have open quote.`, getLineNumberForPosition(xmlData, i));
|
||||
}
|
||||
let attrStr = result.value;
|
||||
i = result.index;
|
||||
@ -87,27 +103,43 @@ exports.validate = function(xmlData, options) {
|
||||
tagFound = true;
|
||||
//continue; //text may presents after self closing tag
|
||||
} else {
|
||||
return isValid;
|
||||
//the result from the nested function returns the position of the error within the attribute
|
||||
//in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
|
||||
//this gives us the absolute index in the entire xml, which we can use to find the line at last
|
||||
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
|
||||
}
|
||||
} else if (closingTag) {
|
||||
if (attrStr.trim().length > 0) {
|
||||
return {
|
||||
err: {code: 'InvalidTag', msg: 'closing tag ' + tagName + " can't have attributes or invalid starting."},
|
||||
};
|
||||
if (!result.tagClosed) {
|
||||
return getErrorObject('InvalidTag', `Closing tag '${tagName}' doesn't have proper closing.`, getLineNumberForPosition(xmlData, i));
|
||||
} else if (attrStr.trim().length > 0) {
|
||||
return getErrorObject('InvalidTag', `Closing tag '${tagName}' can't have attributes or invalid starting.`, getLineNumberForPosition(xmlData, i));
|
||||
} else {
|
||||
const otg = tags.pop();
|
||||
if (tagName !== otg) {
|
||||
return {
|
||||
err: {code: 'InvalidTag', msg: 'closing tag ' + otg + ' is expected inplace of ' + tagName + '.'},
|
||||
};
|
||||
return getErrorObject('InvalidTag', `Closing tag '${otg}' is expected inplace of '${tagName}'.`, getLineNumberForPosition(xmlData, i));
|
||||
}
|
||||
|
||||
//when there are no more tags, we reached the root level.
|
||||
if(tags.length == 0)
|
||||
{
|
||||
reachedRoot = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const isValid = validateAttributeString(attrStr, options, regxAttrName);
|
||||
if (isValid !== true) {
|
||||
return isValid;
|
||||
//the result from the nested function returns the position of the error within the attribute
|
||||
//in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
|
||||
//this gives us the absolute index in the entire xml, which we can use to find the line at last
|
||||
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
|
||||
}
|
||||
|
||||
//if the root level has been reached before ...
|
||||
if(reachedRoot === true) {
|
||||
return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i));
|
||||
} else {
|
||||
tags.push(tagName);
|
||||
}
|
||||
tags.push(tagName);
|
||||
tagFound = true;
|
||||
}
|
||||
|
||||
@ -133,16 +165,14 @@ exports.validate = function(xmlData, options) {
|
||||
if (xmlData[i] === ' ' || xmlData[i] === '\t' || xmlData[i] === '\n' || xmlData[i] === '\r') {
|
||||
continue;
|
||||
}
|
||||
return {err: {code: 'InvalidChar', msg: 'char ' + xmlData[i] + ' is not expected .'}};
|
||||
return getErrorObject('InvalidChar', `char '${xmlData[i]}' is not expected.`, getLineNumberForPosition(xmlData, i));
|
||||
}
|
||||
}
|
||||
|
||||
if (!tagFound) {
|
||||
return {err: {code: 'InvalidXml', msg: 'Start tag expected.'}};
|
||||
return getErrorObject('InvalidXml', 'Start tag expected.', 1);
|
||||
} else if (tags.length > 0) {
|
||||
return {
|
||||
err: {code: 'InvalidXml', msg: 'Invalid ' + JSON.stringify(tags, null, 4).replace(/\r?\n/g, '') + ' found.'},
|
||||
};
|
||||
return getErrorObject('InvalidXml', `Invalid '${JSON.stringify(tags, null, 4).replace(/\r?\n/g, '')}' found.`, 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -160,7 +190,7 @@ function readPI(xmlData, i) {
|
||||
//tagname
|
||||
var tagname = xmlData.substr(start, i - start);
|
||||
if (i > 5 && tagname === 'xml') {
|
||||
return {err: {code: 'InvalidXml', msg: 'XML declaration allowed only at the start of the document.'}};
|
||||
return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i));
|
||||
} else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {
|
||||
//check if valid attribut string
|
||||
i++;
|
||||
@ -235,6 +265,7 @@ var singleQuote = "'";
|
||||
function readAttributeStr(xmlData, i) {
|
||||
let attrStr = '';
|
||||
let startChar = '';
|
||||
let tagClosed = false;
|
||||
for (; i < xmlData.length; i++) {
|
||||
if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
|
||||
if (startChar === '') {
|
||||
@ -247,6 +278,7 @@ function readAttributeStr(xmlData, i) {
|
||||
}
|
||||
} else if (xmlData[i] === '>') {
|
||||
if (startChar === '') {
|
||||
tagClosed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -256,7 +288,7 @@ function readAttributeStr(xmlData, i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return {value: attrStr, index: i};
|
||||
return { value: attrStr, index: i, tagClosed: tagClosed };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -275,34 +307,40 @@ function validateAttributeString(attrStr, options, regxAttrName) {
|
||||
const attrNames = {};
|
||||
|
||||
for (let i = 0; i < matches.length; i++) {
|
||||
//console.log(matches[i]);
|
||||
|
||||
if (matches[i][1].length === 0) {
|
||||
//nospace before attribute name: a="sd"b="saf"
|
||||
return {err: {code: 'InvalidAttr', msg: 'attribute ' + matches[i][2] + ' has no space in starting.'}};
|
||||
return getErrorObject('InvalidAttr', `Attribute '${matches[i][2]}' has no space in starting.`, getPositionFromMatch(attrStr, matches[i][0]))
|
||||
} else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {
|
||||
//independent attribute: ab
|
||||
return {err: {code: 'InvalidAttr', msg: 'boolean attribute ' + matches[i][2] + ' is not allowed.'}};
|
||||
return getErrorObject('InvalidAttr', `boolean attribute '${matches[i][2]}' is not allowed.`, getPositionFromMatch(attrStr, matches[i][0]));
|
||||
}
|
||||
/* else if(matches[i][6] === undefined){//attribute without value: ab=
|
||||
return { err: { code:"InvalidAttr",msg:"attribute " + matches[i][2] + " has no value assigned."}};
|
||||
} */
|
||||
const attrName = matches[i][2];
|
||||
if (!validateAttrName(attrName, regxAttrName)) {
|
||||
return {err: {code: 'InvalidAttr', msg: 'attribute ' + attrName + ' is an invalid name.'}};
|
||||
return getErrorObject('InvalidAttr', `Attribute '${attrName}' is an invalid name.`, getPositionFromMatch(attrStr, matches[i][0]));
|
||||
}
|
||||
if (!attrNames.hasOwnProperty(attrName)) {
|
||||
//check for duplicate attribute.
|
||||
attrNames[attrName] = 1;
|
||||
} else {
|
||||
return {err: {code: 'InvalidAttr', msg: 'attribute ' + attrName + ' is repeated.'}};
|
||||
return getErrorObject('InvalidAttr', `Attribute '${attrName}' is repeated.`, getPositionFromMatch(attrStr, matches[i][0]));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// const validAttrRegxp = /^[_a-zA-Z][\w\-.:]*$/;
|
||||
function getErrorObject(code, message, lineNumber) {
|
||||
return {
|
||||
err: {
|
||||
code: code,
|
||||
msg: message,
|
||||
line: lineNumber,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function validateAttrName(attrName, regxAttrName) {
|
||||
// const validAttrRegxp = new RegExp(regxAttrName);
|
||||
@ -315,5 +353,17 @@ function validateAttrName(attrName, regxAttrName) {
|
||||
function validateTagName(tagname, regxTagName) {
|
||||
/*if(util.doesMatch(tagname,startsWithXML)) return false;
|
||||
else*/
|
||||
//return !tagname.toLowerCase().startsWith("xml") || !util.doesNotMatch(tagname, regxTagName);
|
||||
return !util.doesNotMatch(tagname, regxTagName);
|
||||
}
|
||||
|
||||
//this function returns the line number for the character at the given index
|
||||
function getLineNumberForPosition(xmlData, index) {
|
||||
var lines = xmlData.substring(0, index).split(/\r?\n/);
|
||||
return lines.length;
|
||||
}
|
||||
|
||||
//this function returns the position of the last character of match within attrStr
|
||||
function getPositionFromMatch(attrStr, match) {
|
||||
return attrStr.indexOf(match) + match.length;
|
||||
}
|
23
node_modules/fast-xml-parser/src/xmlstr2xmlnode.js
generated
vendored
23
node_modules/fast-xml-parser/src/xmlstr2xmlnode.js
generated
vendored
@ -33,10 +33,10 @@ const defaultOptions = {
|
||||
cdataTagName: false,
|
||||
cdataPositionChar: '\\c',
|
||||
localeRange: '',
|
||||
tagValueProcessor: function(a) {
|
||||
tagValueProcessor: function(a, tagName) {
|
||||
return a;
|
||||
},
|
||||
attrValueProcessor: function(a) {
|
||||
attrValueProcessor: function(a, attrName) {
|
||||
return a;
|
||||
},
|
||||
stopNodes: []
|
||||
@ -84,7 +84,7 @@ const getTraversalObj = function(xmlData, options) {
|
||||
if (tagType === TagType.CLOSING) {
|
||||
//add parsed data to parent node
|
||||
if (currentNode.parent && tag[14]) {
|
||||
currentNode.parent.val = util.getValue(currentNode.parent.val) + '' + processTagValue(tag[14], options);
|
||||
currentNode.parent.val = util.getValue(currentNode.parent.val) + '' + processTagValue(tag, options, currentNode.parent.tagname);
|
||||
}
|
||||
if (options.stopNodes.length && options.stopNodes.includes(currentNode.tagname)) {
|
||||
currentNode.child = []
|
||||
@ -102,14 +102,14 @@ const getTraversalObj = function(xmlData, options) {
|
||||
currentNode.val = util.getValue(currentNode.val) + options.cdataPositionChar;
|
||||
//add rest value to parent node
|
||||
if (tag[14]) {
|
||||
currentNode.val += processTagValue(tag[14], options);
|
||||
currentNode.val += processTagValue(tag, options);
|
||||
}
|
||||
} else {
|
||||
currentNode.val = (currentNode.val || '') + (tag[3] || '') + processTagValue(tag[14], options);
|
||||
currentNode.val = (currentNode.val || '') + (tag[3] || '') + processTagValue(tag, options);
|
||||
}
|
||||
} else if (tagType === TagType.SELF) {
|
||||
if (currentNode && tag[14]) {
|
||||
currentNode.val = util.getValue(currentNode.val) + '' + processTagValue(tag[14], options);
|
||||
currentNode.val = util.getValue(currentNode.val) + '' + processTagValue(tag, options);
|
||||
}
|
||||
|
||||
const childNode = new xmlNode(options.ignoreNameSpace ? tag[7] : tag[5], currentNode, '');
|
||||
@ -123,7 +123,7 @@ const getTraversalObj = function(xmlData, options) {
|
||||
const childNode = new xmlNode(
|
||||
options.ignoreNameSpace ? tag[7] : tag[5],
|
||||
currentNode,
|
||||
processTagValue(tag[14], options)
|
||||
processTagValue(tag, options)
|
||||
);
|
||||
if (options.stopNodes.length && options.stopNodes.includes(childNode.tagname)) {
|
||||
childNode.startIndex=tag.index + tag[1].length
|
||||
@ -140,12 +140,14 @@ const getTraversalObj = function(xmlData, options) {
|
||||
return xmlObj;
|
||||
};
|
||||
|
||||
function processTagValue(val, options) {
|
||||
function processTagValue(parsedTags, options, parentTagName) {
|
||||
const tagName = parsedTags[7] || parentTagName;
|
||||
let val = parsedTags[14];
|
||||
if (val) {
|
||||
if (options.trimValues) {
|
||||
val = val.trim();
|
||||
}
|
||||
val = options.tagValueProcessor(val);
|
||||
val = options.tagValueProcessor(val, tagName);
|
||||
val = parseValue(val, options.parseNodeValue, options.parseTrueNumberOnly);
|
||||
}
|
||||
|
||||
@ -189,6 +191,7 @@ function parseValue(val, shouldParse, parseTrueNumberOnly) {
|
||||
parsed = Number.parseInt(val, 16);
|
||||
} else if (val.indexOf('.') !== -1) {
|
||||
parsed = Number.parseFloat(val);
|
||||
val = val.replace(/0+$/,"");
|
||||
} else {
|
||||
parsed = Number.parseInt(val, 10);
|
||||
}
|
||||
@ -225,7 +228,7 @@ function buildAttributesMap(attrStr, options) {
|
||||
if (options.trimValues) {
|
||||
matches[i][4] = matches[i][4].trim();
|
||||
}
|
||||
matches[i][4] = options.attrValueProcessor(matches[i][4]);
|
||||
matches[i][4] = options.attrValueProcessor(matches[i][4], attrName);
|
||||
attrs[options.attributeNamePrefix + attrName] = parseValue(
|
||||
matches[i][4],
|
||||
options.parseAttributeValue,
|
||||
|
3959
node_modules/fast-xml-parser/yarn.lock
generated
vendored
3959
node_modules/fast-xml-parser/yarn.lock
generated
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user