users@jaxb.java.net

RE: Java objects to XML Mapping.

From: Damon Goodyear <damongoodyear_at_hotmail.com>
Date: Wed, 8 Jul 2009 11:38:13 +0100

If you find suitable alternative I'd be interested to know. I tried XMLBeans but the complexity didn't seem worth it - I'm therefore back to using JAXB.

 

If anyone know a way of threading the marshalling process separately, so as to be able to chunk output, I'd also be interested to know (the thing that made me try XMLBeans in the first place).



Damon Goodyear



 



From: varun.rally_at_rbs.com
To: users_at_jaxb.dev.java.net
Date: Wed, 8 Jul 2009 08:17:50 +0100
Subject: RE: Java objects to XML Mapping.


Actually, we don't have control over schema, and we cannot change anything inside it. It is given to us by third party system that accepts the XML that we generate.
 
 
But yes the following is the scenario...
 
we cannot change the XML Schema and the information that needs to be populated in the XML is present in 2 different Java Objects that have been populated from 2 DataBase tables.
 
So what would be the best way to go for it.
--->>>Also, we are open for using technologies other than JAXB, if they better fit the requirement.
 
 
 



From: Wolfgang Laun [mailto:wolfgang.laun_at_gmail.com]
Sent: 08 July 2009 12:42
To: users_at_jaxb.dev.java.net
Subject: Re: Java objects to XML Mapping.



You might study the JAXB tutorial https://jaxb.dev.java.net/tutorial/
 
Chapter 2 contains some advice for writing XML schemas that
will result in good Java code. (It is difficult to imagine that your
120 classes don't contain duplicates, resulting from anonymous
types. So, some rewriting of your schema might reduce this
number, perhaps even considerably.)
 
Chapter 6 discusses annotations, which is the way to go if you
want to marshal using existing Java classes.
 
Better advice could be given after seeing (part of) your schema
(consistent substitutions might be sufficient to camouflage its
contents, if that's bothering you).
 
-W

 
On 7/8/09, varun.rally_at_rbs.com <varun.rally_at_rbs.com> wrote:
Ok, I will but I just want to make sure I am on the right track.

So with JAXB, it is possible to use pre-existing Java objects and annotate their fields to create a XML that confirms to a particular schema. Is that correct? If yes, how JAXB will find all classes that have annotations.


-----Original Message-----
From: aleksei.valikov_at_gmail.com [mailto:aleksei.valikov_at_gmail.com] On Behalf Of Aleksei Valikov
Sent: 08 July 2009 12:28
To: users_at_jaxb.dev.java.net
Subject: Re: Java objects to XML Mapping.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net


***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority.

This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The
Royal Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.

Visit our website at www.rbs.com

***********************************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net


***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority.
 
This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The
Royal Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.

Visit our website at www.rbs.com

***********************************************************************************