added alwaysCreateTextNode option to force text node creation #365
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose / Goal
This is a feature request for an option that makes the parser return a property for the textNodeName even if there are no attributes or node children. This prevents the downstream consuming JS to require checks for the text node and if it doesn't exist, use the property path itself.
Option would default to false so that the current behavior remains default.
Type
Please mention the type of PR
Issue
349
Perfomance tests
Before
Running Suite: XML Parser benchmark
validation : 22482.344697710287 requests/second
xml to json : 15002.244861535037 requests/second
xml to json + json string : 13868.767986614608 requests/second
xml to json string : 2939.2827347641673 requests/second
xml2js : 5709.279811841135 requests/second
After
Running Suite: XML Parser benchmark
validation : 22732.947506604152 requests/second
xml to json : 15270.010037240734 requests/second
xml to json + json string : 14049.966577736843 requests/second
xml to json string : 2906.0090047436674 requests/second
xml2js : 5690.710124230496 requests/second