Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trimmed whitespace on decoding String #94

Closed
flowbe opened this issue Apr 30, 2019 · 3 comments · Fixed by #92
Closed

Trimmed whitespace on decoding String #94

flowbe opened this issue Apr 30, 2019 · 3 comments · Fixed by #92
Assignees

Comments

@flowbe
Copy link
Contributor

flowbe commented Apr 30, 2019

I had another issue with the library when decoding strings. For example if I have a string with a whitespace at the end in my XML, it will get trimmed when decoding but I don't want this behavior.

Moreover, when an element contains an empty string, it is automatically interpreted as nil.

@MaxDesiatov MaxDesiatov self-assigned this Apr 30, 2019
@MaxDesiatov
Copy link
Collaborator

Hi @TheFlow95, thanks for reporting this. The conversion of empty strings to nil is now fixed in #92. As for trimming the whitespaces, I think the best way forward would be to add a property on XMLDecoder like trimValueWhitespaces to turn the trimming off, while the default value would be true for backward compatibility.

MaxDesiatov added a commit that referenced this issue May 1, 2019
Fix an issue uncovered by CoreOffice/CoreXLSX#59. Also include slightly unrelated cleanups.

Resolve #94 

* Fix empty element decoded as optional
* Add failing test case to SpacePreserveTest
* Disable `nesting` SwiftLint rule
* Fix handling of nested empty string values
* Add trimValueWhitespaces property on XMLDecoder
@MaxDesiatov
Copy link
Collaborator

This is now fixed in master and will be included in 0.5 release, which I'm going to tag soon.

@MaxDesiatov
Copy link
Collaborator

trimValueWhitespaces has also been added in #92 and is now available in master.

arjungupta0107 pushed a commit to salido/XMLCoder that referenced this issue Jun 26, 2020
Fix an issue uncovered by CoreOffice/CoreXLSX#59. Also include slightly unrelated cleanups.

Resolve CoreOffice#94 

* Fix empty element decoded as optional
* Add failing test case to SpacePreserveTest
* Disable `nesting` SwiftLint rule
* Fix handling of nested empty string values
* Add trimValueWhitespaces property on XMLDecoder
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 a pull request may close this issue.

2 participants