From a legacy free-style web service, I'm receiving data of the following kind:
<settings>
<key1>value1</key1>
<key2>value2</key2>
...
<keyN>valueN</keyN>
</settings>
The element names key1, key2, ...
are not known beforehand and could be any identifier, so this is not easily expressible in XSD except by any
and not directly mappable in JAXB.
Is it possible, using any JAXB extension, to somehow map this to
public class Settings {
private List<Property> properties;
}
public Property {
private String key;
private String value;
}
I tried MOXy's @XPath
, but could not find a suitable XPath expression.
Any solution is welcome, it doesn't have to be MOXy.
In MOXy we offer this mapping through the @XmlVariableNode
extension: