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.