[Simple-support] Deserialize any element (xsd:any)
Brought to you by:
niallg
|
From: Christian S. <chr...@gm...> - 2014-11-07 23:12:44
|
Hi all,
I am trying to deserialize an XML String to an object.
The problem I am having is that the object can have *any* element (xsd:any).
I tried it that way:
@Root
public class Container
{
@Element(required = false)
private Object anyElement;
}
But when deserializing the following XML:
<container><xyz xmlns=„any_arbitrary_namespace“/></container>
I get a org.simpleframework.xml.core.ElementException: Element ‚xyz' does not have a match in class…
I have a class which would map to the xyz element.
I also thought, that I have to register it (similar to creating a JAXBContext), so that the persister is aware of it, like:
registry.lookup(Xyz.class);
but I doesn’t work.
Here’s the same question:
http://stackoverflow.com/questions/26361729/simplexml-any-element-matching
Thanks for help,
Christian
|