NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.
https://naturalintelligence.github.io/fast-xml-parser/
MIT License
2.53k stars 303 forks source link

Fix character reference parsing #569

Open Pharb opened 1 year ago

Pharb commented 1 year ago

Ignore leading zeros and case-insensitive hexadecimal characters.

Purpose / Goal

Fixes: https://github.com/NaturalIntelligence/fast-xml-parser/issues/568

Type

Please mention the type of PR

Note : Please ensure that you've read contribution guidelines before raising this PR. If your PR is in progress, please prepend [WIP] in PR title. Your PR will be reviewed when [WIP] will be removed from the PR title.

Bookmark this repository for further updates.

Benchmark

on master c7b3cea4ead020c21d39e135a50348208829e971:

$ node benchmark/XmlParser.js
Running Suite: XML Parser benchmark
fxp v3 : 104492.65920369806 requests/second
fxp : 71740.31616855874 requests/second
fxp - preserve order : 79167.16811125632 requests/second
xmlbuilder2 : 30097.740319390698 requests/second
xml2js  : 19269.565779616878 requests/second

$ node benchmark/XmlBuilder.js
Running Suite: XML Builder benchmark
fxp : 115721.94119323186 requests/second
fxp - preserve order : 254535096.4923456 requests/second
xml2js  : 30245.690942021945 requests/second

on PR branch 7ffae077283a5b88ca9ed3fa864fd403c1d22b22:

$  node benchmark/XmlParser.js
Running Suite: XML Parser benchmark
fxp v3 : 104906.50130850698 requests/second
fxp : 70241.16491572408 requests/second
fxp - preserve order : 77212.26547824622 requests/second
xmlbuilder2 : 30320.162156061833 requests/second
xml2js  : 19072.050992656794 requests/second

$ node benchmark/XmlBuilder.js
Running Suite: XML Builder benchmark
fxp : 114569.05961947251 requests/second
fxp - preserve order : 249648275.08603555 requests/second
xml2js  : 30008.326170982098 requests/second
amitguptagwl commented 1 year ago

Thanks for the PR. As there are some big changes in progress, I'll consider this PR after that or will pick them selectively.