Closed wooj2 closed 3 years ago
Merging #222 (02da507) into main (a469f60) will increase coverage by
0.37%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #222 +/- ##
==========================================
+ Coverage 73.50% 73.87% +0.37%
==========================================
Files 46 46
Lines 2404 2431 +27
==========================================
+ Hits 1767 1796 +29
+ Misses 637 635 -2
Impacted Files | Coverage Δ | |
---|---|---|
...urces/XMLCoder/Auxiliaries/String+Extensions.swift | 100.00% <100.00%> (ø) |
|
Sources/XMLCoder/Auxiliaries/XMLCoderElement.swift | 96.39% <100.00%> (+0.04%) |
:arrow_up: |
Sources/XMLCoder/Auxiliaries/XMLStackParser.swift | 93.93% <100.00%> (+1.16%) |
:arrow_up: |
Sources/XMLCoder/Decoder/XMLDecoder.swift | 78.72% <100.00%> (+2.08%) |
:arrow_up: |
...es/XMLCoder/Decoder/XMLDecoderImplementation.swift | 67.74% <0.00%> (+0.19%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update a469f60...02da507. Read the comment docs.
@wooj2 one last request, I promise 🙂
Can you add a subsection to the "Advanced features" section in README.md
about this new flag? You can state it's available starting with the 0.13.0 release, which I'm going to tag after this is merged.
Just an example of your use case and a short description of the feature, similar to other subsections that describe advanced features. Thank you!
@wooj2 one last request, I promise 🙂
Can you add a subsection to the "Advanced features" section in
README.md
about this new flag? You can state it's available starting with the 0.13.0 release, which I'm going to tag after this is merged.Just an example of your use case and a short description of the feature, similar to other subsections that describe advanced features. Thank you!
No prob at all! Just updated it. Thanks again for all the support
@kneekey23 @wooj2 perfect, thanks for uncovering this edge case! Your contribution is very appreciated 👏
This updates the
XMLStackParser
to accept a parameter calledremoveWhitespaceElements
.The purpose of the
XMLStackParser
is to call the XML parser and create a tree ofXMLCoderElement
representing the structure of the parsed XML.Assuming that XMLStackParser has
trimValueWhitespaces
set tofalse
, when attempting to parse a nested data structure like the following:... then there will multiple
XMLCoderElement
s in the tree which will haveelements
set to elements that are either: a. Purely whitespaced elements or b. The child elementsThese purely whitespaced elements are problematic for users who are implementing custom
Decoder
logic, as they are interpreted as regular child elements. Therefore, settingremoveWhitespaceElements
totrue
whiletrimValueWhitespaces
is set tofalse
, will remove these whitespace elements during the construction of theXMLCoderElement
tree.An in-depth analysis of the original problem can be found here.
For historical purposes, a separate approach was implemented. It uses a similar algorithm in a different part of the code. https://github.com/MaxDesiatov/XMLCoder/pull/221