xmlutil
xmlutil copied to clipboard
Parse children of a node as generic `Element`
Hello,
Consider the following:
<Extensions>
<Extension type="AdVerifications">
<AdVerifications>
<Verification vendor="Something">
<JavaScriptResource apiFramework="omid" browserOptional="true">
<![CDATA[https://google.com/video.js]]>
</JavaScriptResource>
<VerificationParameters>
<![CDATA[{"key":"21649"}]]>
</VerificationParameters>
</Verification>
</AdVerifications>
</Extension>
</Extensions>
@Serializable
class Base {
var extensions: Extensions? = null
@Serializable
class Extensions {
var extension: List<Extension>? = null
@Serializable
class Extension {
var type: String? = null
val value: List<Element> = emptyList()
}
}
}
Is it possible to have the children to be set in the List<Element> property?
Currently, I get an error saying:
UnknownXmlFieldException: Could not find a field for name (Base.Extensions.Extension) Extension/AdVerifications (Element)
candidates: type (Attribute), value (Element) at position