![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]()
|
How to map a collection of elementsIntended Audience Prerequisites Basic concept Mapping file XML output References Intended AudienceAnyone who wants to map a collection 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 Order and OrderItem, where an order holds a list of order items.
As shown above, the Order instance has a field 'OrderItems' to hold a list of OrderItem instances. Mapping fileHere's the mapping file to instruct Castor XML about the relation of those two classes, Order and OrderItem respectively:
XML outputUsing the Castor XML marshaller with the mapping file shown above, the XML generated by Castor XML might look as follows:
References
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() ![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |