![]() | ![]() | ![]() | ![]() | ![]() | ![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]()
|
How to map a list of elements at the rootIntended Audience Prerequisites Basic concept Mapping file Unmarshalling Marshalling References Intended AudienceAnyone who wants to map a list of elements at the document root. This document helps people to get familiar with the basic concepts of mapping and shows an example. PrerequisitesNone. Basic conceptAssume you have a java.util.List (java.util.ArrayList) and an OrderItem classes, where the List instance simply holds a list of order items.
Mapping fileHere's the mapping file for Castor XML, showing the class mapping for the OrderItem class:
UnmarshallingUsing the Castor XML Unmarshaller with the mapping file shown above, the code to unmarshal the XML shown below ...
... into a variable of type java.util.ArrayList is shown subsequently:
MarshallingUsing the Castor XML Marshaller with the mapping file shown above, the code to marshal a List of OrderItem instances to XML is shown below.
References
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |