Perhaps I am overlooking this, but I think it would be useful if the starting node could be specified in some way, perhaps via XPath. While trying to implement an RSS feed, I found that I either have to implement the parent node to get to the child nodes I am interested in or write my own init(from decoder: Decoder).
For example:
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Title</title>
…
</channel>
</rss>
To get to the title node, I need to implement a type for the channel node as well:
struct RSSFeed: Decodable {
let channel: Channel
struct Channel: Decodable {
let title: String
}
}
Perhaps I am overlooking this, but I think it would be useful if the starting node could be specified in some way, perhaps via XPath. While trying to implement an RSS feed, I found that I either have to implement the parent node to get to the child nodes I am interested in or write my own
init(from decoder: Decoder).For example:
To get to the
titlenode, I need to implement a type for thechannelnode as well: