Closed Rashxz closed 3 days ago
In the policy you can add a handler for unknown fields/elements. This returns a list of the recovered values (which can be an empty list) or throws an exception (the default). However, see #256, there is an issue with it in the case of a value child (the @XmlValue
annotation).
An alternate approach is to use the fallback options (@XmlOtherAttributes
with either Map<QName,String>
or Map<String,String>
- the string is default, but it should work for anything that can parse from a string), and for elements an @XmlValue
List<Node>
or List<Element>
(or other type with a serializer implementing XmlDeserializationStrategy
(this needed to consume the random xml)).
This approach will actually record the values in a generic way (which can be written out).
Thanks, the policy works perfectly.
Hi, Im tryng to deserialze a xml response that have a lot of fields, but I will only be using a few, so dont what to specify all of them as that will be time consuming and having only necesary fields will make it easier to read.
This is my class:
If i put all of the fields of ClientDataItem the deserialization works just fine, but if I only leave a fews I got the UnknownXmlFieldException exception. So is there anyway to just ignore the rest of fields when deserializing?