users@jaxb.java.net

Re: Java objects to XML Mapping.

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 8 Jul 2009 08:57:59 +0200

Hi,

> Actually we need to populate each and every element inside the XML. JAXB has created a class for each element in XML. Hence if we go with the first approach, then we will definitely require all 120+ classes.

If you need to populate each and every element inside the XML then I
don't see why you mind having 120 classes. Would you prefer two or
three huge classes?

By the way, usually JAXB does not create a class per element, it's
usually class per complex type. 120 classes would mean the order of
120 complex types in your schema for me.

> 2nd approach looks better to me as well, but I don't have any idea on how to achieve it. Can you please through some more light on the second option.
>
> For Example, let us say there is tag <employeeName>. Its value needs to be populated from some class for example..BankAccountDetails and the field name is ename. Then how do we proceed in the right direction.
>
> Also, please share some internet references for the 2nd option that I can look at, learn and implement.

To be honest, I don't feel like quoting Google.
You may start with the Chapter 8 of the JAXB specification, it
explains Java Type to XML binding.

Bye.
/lexi