JAXB / MOXy - not unmarshalling values after ignored elements [message #1112048] |
Thu, 19 September 2013 00:04  |
Eclipse User |
|
|
|
I'm working on a JAXB/MOXy XML parsing implementation using EclipseLink v2.1.3 (old, I know but we're still tied to Java 5) and I've encountered an issue with unmarshalling.
Part of the document has the following XML:
<Product>
<Code>code</Code>
<Desc>description</Desc>
</ProductInfo>
The object I'm parsing this into has the following field and annotation:
@XmlElement(name = "Product/Desc")
private String description;
That is, it tries to extract the "Desc" value, but doesn't care about the "Code". I'm finding that the description field is null after unmarshalling the XML. However, if I add in a field to extract "Code":
@XmlElement(name = "Product/Code")
private String code;
then description field is not null, and contains the correct value - both values get populated.
I've found the same issue elsewhere in the XML and it seems to be that if I try to skip / ignore certain XML elements, values after that skipped elements are also ignored.
Is this a known issue, and is there a workaround for it?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03846 seconds