Skip to content

Conversation

brainsiq
Copy link
Contributor

Purpose / Goal

Bugfix for #129

When validating XML containing a 'length' attribute currently an error is always returned 'attribute length is repeated.'.

This is because the code uses an array to check for repeated attributes and calls hasOwnProperty('length'). I have changed this to use an object instead of an array so hasOwnProperty('length') will only return true when there are multiple length attributes. The test I have added verifies this.

Type

[x]Bug Fix
[ ]Refactoring / Technology upgrade
[ ]New Feature

Benchmark results:

❯ node benchmark/perfTest3.js
Running Suite: XML Parser benchmark
validation : 15075.528720836128 requests/second
xml to json : 13612.412033517821 requests/second
xml to json + json string : 12826.365584690317 requests/second
xml to json string : 2125.6406392103368 requests/second
xml2js  : 5101.253171761319 requests/second

@brainsiq
Copy link
Contributor Author

I also noticed that the package-lock.json version is out of sync with the package.json, so it changed when i npm installed. I did not commit this change.

diff --git a/package-lock.json b/package-lock.json
index f3de5d5..15b0485 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "fast-xml-parser",
-  "version": "3.12.5",
+  "version": "3.12.8",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.487% when pulling dc2e7b5 on brainsiq:bugfix/validate-length-attribute into abb41cb on NaturalIntelligence:master.

@amitguptagwl
Copy link
Member

Thanks @brainsiq for the PR. I'll update package-lock.json

@amitguptagwl amitguptagwl merged commit 42d7599 into NaturalIntelligence:master Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants