Create model class for XML files with multiple hierarchical levels using JAXB and Java -
i'm working jaxb , try create model class xml-file multiple hierarchical levels.
in first try created every xmlwrapper seperated modelclass, guess theres way handle in 1 class.
the proper way not put in 1 class, instead use several classes:
- a
class notesdocument
, annotated@xmlrootelement(name="notes_document")
- a
class item
- a
class value
not needed,string
enough
the notesdocument
class contain among other things:
private list<item> items; @xmlelementwrapper(name="items") @xmlelement(name="item") public list<item> getitems() { return items; }
the item
class contain similar construct list<string> values
.
you figured out correctly how use @xmlelementwrapper(name="items")
, don't need separate class items
modeling <items>
collection. same go modeling <values>
collection.
i think that's enough details you, don't want spoil learning experience. ;-)
Comments
Post a Comment