Skip to content

Commit

Permalink
Add docs related to trimValueWhitespaces to README
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxDesiatov authored and Arjun Gupta committed Jun 26, 2020
1 parent e0d2bdd commit 9bffdf1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ struct Foo: Codable, DynamicNodeEncoding {
}
```

### Preserving whitespaces in element content

By default whitespaces are trimmed in element content during decoding. This
includes string values decoded with [value intrinsic keys](#coding-key-value-intrinsic). Starting with version 0.5 you can now set a
property `trimValueWhitespaces` to `false` (the default value is `true`) on
`XMLDecoder` instance to preserve all whitespaces in decoded strings.

## Installation

### Requirements
Expand Down
2 changes: 1 addition & 1 deletion Sources/XMLCoder/Auxiliaries/XMLCoderElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct XMLCoderElement: Equatable {
}

func flatten() -> KeyedBox {
let attributes = KeyedStorage(self.attributes.map { (key, value) in
let attributes = KeyedStorage(self.attributes.map { key, value in
(key: key, value: StringBox(value) as SimpleBox)
})
let storage = KeyedStorage<String, Box>()
Expand Down

0 comments on commit 9bffdf1

Please sign in to comment.