0.4.0
This is a release with plenty of new features that allow you to parse many more XML variations than previously. Compatibility with Xcode 10.2 and Swift 5.0 is also improved. A huge thank you to @JoeMatt and @regexident for their contributions, to @hodovani for maintaining the project, and to @Inukinator, @qmoya, @Ma-He, @khoogheem and @thecb4 for reporting issues during development!
Notable changes
- Ordered encoding: this was one of the most requested changes and it's finally here! 🎉 Now both keyed and unkeyed elements are encoded in the exactly same order that was used in original containers. This is applicable to both compiler-generated encoding implementations (just reorder properties or cases in your
CodingKeys
enum if you have it) and manually implementedfunc encode(to: Encoder)
. - Stripping namespace prefix: now if your coding key string values contain an XML namespace prefix (e.g. prefix
h
in<h:td>Apples</h:td>
), you can setshouldProcessNamespaces
property totrue
on yourXMLDecoder
instance for the prefix to be stripped before decoding keys in yourDecodable
types. - Previously it was possible to customize encoding with
NodeEncodingStrategy
, but no such type existed for decoding. A correspondingNodeDecodingStrategy
type was added withnodeDecodingStrategy
property onXMLDecoder
. - Thanks to the previous change, XMLCoder now provides two helper protocols that allow you to easily customize whether nodes are encoded and decoded as attributes or elements for conforming types:
DynamicNodeEncoding
andDynamicNodeDecoding
. - Previously if you needed to decode or encode an XML element with both attributes and values, this was impossible to do with XMLCoder. Now with the addition of coding key value intrinsic, this is as easy as adding one coding key with a specific string raw value (
"value"
or empty string""
if you already have an XML attribute named"value"
).
Closed issues
- Crash: Range invalid bounds in
XMLStackParser.swift
#83 - Document DynamicNodeEncoding and attributed intrinsic #80
- Fix nested attributed intrinsic #78
nodeEncodingStrategy
#49- XmlEncoder: ordering of elements #17
- Can’t reach an XML value #12
Merged pull requests
- Make value intrinsic smarter #89 (@MaxDesiatov)
- Refactor XMLCoderElement.flatten, add tests #88 (@MaxDesiatov)
- Add separate lint stage to .travis.yml #87 (@MaxDesiatov)
- Add multiple Xcode versions to Travis build matrix #86 (@MaxDesiatov)
- Add DynamicNodeDecoding protocol #85 (@MaxDesiatov)
- Improve tests and fix error context handling #84 (MaxDesiatov)
- Ordered encoding #82 (@MaxDesiatov)
- Add
shouldProcessNamespaces
decoder property #81 (@MaxDesiatov) - Fix nested attributed intrinsic #79 (@MaxDesiatov)
- Fix compatibility with Swift 5.0 #77 (@MaxDesiatov)
- Attributed Intrinsic (value coding key) #73 (JoeMatt)
- Dynamic node encoding + new formatters + various fixes #70 (@JoeMatt)
- Add
NodeDecodingStrategy
, mirroringNodeEncodingStrategy
#45 (@regexident)