File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes XmlBeans and Java Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XmlBeans and Java Objects" Watch "XmlBeans and Java Objects" New topic

XmlBeans and Java Objects

Lee Miller

Joined: May 23, 2008
Posts: 5

I have a number of Java Objects which I need to convert to XmlBeans. I am using Castor to marshall the Java Objects to a String and am using the parse method on XmlBeans to create the XmlBean object. The String produced as a result of Castor mapping is correct for creating an XmlBean (with a bit of tweaking) but the problem is that the fields are not in the correct sequence and the XmlBean is therefore not valid. I presume I could get round this by specifically mapping every field in a castor mapping file in the correct order, but there are hundreds of Java Objects, and I was hoping to take advantage of the auto complete feature as much as possible.

I'm basically looking for any suggestions as to how I can create an XmlBean from a Java Object without having to go down specifying each individual field in order, either using the way I describe or something else.

All the best.
I agree. Here's the link:
subject: XmlBeans and Java Objects
It's not a secret anymore!