![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]()
|
How to map a map/hashtable of elementsIntended Audience Prerequisites Basic concept Mapping file XML output References Intended AudienceAnyone who wants to map a Map/Hashtable of elements. This document helps people to get familiar with the basic concepts of mapping and shows an example. PrerequisitesNone. Basic conceptAssume you have two classes Items and Item, where an Items instance holds a Map/Hashtable of Item instances.
As shown above, the Items instance has a field 'itemList' to hold a Hashtable of Item instances. Mapping fileHere's the mapping file to instruct Castor XML about the relation of those two classes, Items and Item respectively:
Please note the use of the org.exolab.castor.mapping.MapItem definition within the <bind-xml> element in above mapping to map the elements containeed in the Map/Hashtable. XML outputUsing the Castor XML marshaller with the mapping file shown above, the XML generated by Castor XML might look as follows:
References
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() ![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |