Closed Kirow closed 4 years ago
Thanks for reporting it @Kirow, the fix for it will be included in the next release.
Hi @MaxDesiatov,
For when is the next release scheduled? Waiting in anticipation for this.
Thanks for a great XML coder!
Hey @kasperkronborg, this is now published in the 0.11 release and is available with SwiftPM, CocoPods and Carthage. Thanks for your feedback, I appreciate your support 🙂
result.data
decoded into""
. Actually there is an error inXMLDecoder.swift:212
-Expected String but found null instead.
If we go deeper -
KeyedBox.swift:27 return elements[""].first as? SimpleBox
. It will returnnil
because key is"#CDATA"
in this case.I've made simple code change that fixed problem in this case, but have no idea what it can break later.
.patch
``` diff --git a/Sources/XMLCoder/Auxiliaries/Box/KeyedBox.swift b/Sources/XMLCoder/Auxiliaries/Box/KeyedBox.swift index 9930bfb..a3e8742 100644 --- a/Sources/XMLCoder/Auxiliaries/Box/KeyedBox.swift +++ b/Sources/XMLCoder/Auxiliaries/Box/KeyedBox.swift @@ -24,7 +24,7 @@ struct KeyedBox { } var value: SimpleBox? { - return elements[""].first as? SimpleBox + return elements.values.first as? SimpleBox } } diff --git a/Sources/XMLCoder/Auxiliaries/KeyedStorage.swift b/Sources/XMLCoder/Auxiliaries/KeyedStorage.swift index 0615ca2..a3fcb50 100644 --- a/Sources/XMLCoder/Auxiliaries/KeyedStorage.swift +++ b/Sources/XMLCoder/Auxiliaries/KeyedStorage.swift @@ -23,6 +23,10 @@ struct KeyedStorage(_ sequence: S) where S: Sequence, S.Element == (Key, Value) { buffer = Buffer() ```