wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes jaxb marshalling problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "jaxb marshalling problem" Watch "jaxb marshalling problem" New topic
Author

jaxb marshalling problem

James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Hi All,

below is my code


and generated xml is


my query is how to avoid creating of element <name>Cath</name>? Please let me know.

Rgds
Peter

Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
1. Rename 'Name' variable to 'Myname'

2. Delete annotation on 'Myname' variable
James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
hi,

thanks for replay. by default jaxb is converting all elements to lowercase.

if i use my variable name as Name then it is converting to <name> which i dont want.
that is why i was testing with annotation. But if I use annotation it is creating 2 elements with "Myname" and also with "name" element.

how to avoid creating of "name" element?

Rgds
Peter
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
how to avoid creating of "name" element?


A better way to phrase your "issue" might be, how can you disable JAXB's automatic case conversion?

The case of the element names is really a trivial aspect. I suggest that you don't worry about.

Actually, mixed-cased element names has always been discouraged in terms of markup language design. So, the JAXB implementation is actually following a best practice. I doubt that it can be modified.

Aside, the way your Java variables are named is also awkward and should be changed.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 499
    
    3
If I understand the problem correctly, this is how you should do.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jaxb marshalling problem
 
Similar Threads
persistence.xml file for MS SQL Server 2000
Hibernate SaveOrUpdate
how to use one-to-one association
Exception while deleting a Entity
Is it me or just Eclipse... JEdit too...