Theres some pretty nasty XML that i’d like to unmarshall to a java object using JaxB. Most of it has seemed quite straightforward so far – but I am kinda stuck on this:
<assets>
<asset type="fixed">74,414</asset>
<asset type="current">1,022,069</asset>
<asset type="other">0</asset>
<total type="assets">1,096,483</total>
</assets>
This is the relevant part of the dtd
<!ELEMENT assets (asset|total)*>
<!ELEMENT asset (#PCDATA)>
<!ATTLIST asset
type CDATA #REQUIRED>
<!ELEMENT total (#PCDATA)>
<!ATTLIST total
type CDATA #REQUIRED>
Any ideas? Or should I give up trying to use JAXB for this?
Thanks
Looking at the XML and the DTD, I created the XSD of the structure:
Use xjc to generate the Java classes annotated with the JAXB binding annotations from the XSD. Then use the unmarshaller to unmarshal it to Java object.
Edit
Generated Java classes: