I have an XML which looks like this :
<MyClass id="abc-123">
<SomeAttribute idref="cde-456" />
</MyClass>
<SomeOtherClass id="cde-456">
And want to bind this using JAXB / Moxy. The best I could achieve so far is
@XmlIDREF
@XmlElement(name="SomeAttribute ")
//@XmlPath("SomeAttribute /@idref")
protected SomeOtherClass someAttribute ;
but this gives only <SomeAttribute>cde-456</SomeAttribute>
Any idea, how binding of the idref attribute might work ? The @XmlPath does not work.
This should work for you:
XML:
Root:
MyClass:
SomeAttribute:
SomeOtherClass:
Main:
Output: