How to ignore unknown elements? #125
Answered
by
pdvrieze
Kryomancer
asked this question in
Q&A
-
I have a large, sprawling XML file but I'm only interested in certain tags, is there any way to avoid having to write a class or property for every single one and simply ignore anything that doesn't have a matching field on the Kotlin side of things? I do not need this to support serializing back into the original in any way, |
Beta Was this translation helpful? Give feedback.
Answered by
pdvrieze
Feb 28, 2023
Replies: 1 comment
-
Yes there is: When you create the format implementation you can configure it with a policy: XML {
defaultPolicy {
pedantic = false
ignoreUnknownChildren() // or ignoreNamespaces() if only tags in other namespaces are to be ignored
}
} // alternatively you can set |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Kryomancer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes there is:
When you create the format implementation you can configure it with a policy:
// alternatively you can set
unknownChildHandler
explicitly to any value you want.