File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes JAXB binding files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAXB binding files" Watch "JAXB binding files" New topic

JAXB binding files

Greg Jewell

Joined: Mar 08, 2002
Posts: 10

I know this isn't strictly web service related, but this seems like the most appropriate forum since JAX-WS utilizes JAXB.

I am using JAXB to generate Java classes from a set of schemas that I have been given. The data types in these schemas reference each other frequently. Due to various reasons, I need to change the name of several fields in the generated code. To do this, I'm using bindings files to look for the nodes in question, and then to rename them in the Java code.

I'm running into issues, however, when a single schema may be processed by xjc multiple times. (As I mentioned, these schemas quite frequently reference each other.) Depending on the order that the schemas are processed, the Java code may be regenerated without the changed parameter names unless I duplicate all of the customization across all of the bindings files.

Is there any way to import/include one binding file in another? I want to do something like this:

I know that xjc allows any number of binding files to be specified, but I'm using ant to invoke the xjc task, and things get hairy when I have different numbers of bindings that are needed for different invocations.

I agree. Here's the link:
subject: JAXB binding files
It's not a secret anymore!