On May 23, 2013, at 5:02 PM, Greg Barker <[email protected]> wrote:
> Hello - > > I'm using the Apache CXF WebClient for a project, and the REST API I am > interacting with has a requirement that XML elements are sent in a specific > order, and "correct" order can change depending on certain settings that > are not known at compile time. > > I've found that the XmlType.propOrder annotation allows me to specify the > order in which I want the XML elements to appear at compile time. This > works great. The problem is that I need to be able to change this order at > runtime, and I cannot figure out a way to do that without resorting to > ugly/hacky solutions that modify the annotation at runtime. > > Is there an easy way to specify XML element order dynamically at runtime? There really isn't an "easy" way to do this. You can look at: https://community.jboss.org/wiki/JAXBIntroductions where they use some hooks into the JAXB RI's runtime to provide a listener that would "mimic" some of the annotations. You may be able to use some of their code to write a listener to mimic the XmlType.propOrder stuff. Not sure. Never really tried. -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
