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 in eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAXB in eclipse" Watch "JAXB in eclipse" New topic

JAXB in eclipse

bhargavi kakarala
Ranch Hand

Joined: Jan 03, 2002
Posts: 82

Are there any samles how to create and run JAXB(Generate schema derived Java classes,Unmarshll XML into Java Objects) in Eclipse IDE.

I was able to generate schema derived classes from command line but now I dont know how to Unmarshall XML doc into JAva Objects.

Thanks in Adavance.

SCJP2,SCWD,SCBCD,IBM Certified SOA Associate,IBM Certified Architectural Design of SOA Solutions
Peer Reynders

Joined: Aug 19, 2005
Posts: 2930
I'm not quite sure what you are asking - seems that there are two questions:

1. How do I run the JAXB binding compiler from Eclipse?

Include a build.xml file in your project that makes use of Sun's XJCTask ant-task (in jaxb-xjc.jar for JAXB 1.0).

Right-click (the build.xml in your project)
Run As
Ant Build

Note that jaxb-xjc.jar is in the "lib" directory specified by the classpath.

2. How do I unmarshal an XML document to a Java content-tree?

Sun's JWSDP 1.6 samples shows how:

To run the (JAXB 1.0) examples you will need to add


from the JWSDP 1.6 distribution to your project's Java Build Path.

jaxb\lib\jaxb-xjc.jar is only needed for its ant task and to compile the bindings.

JWSDP 1.6 Tutorial: Chapter 2 Using JAXB
[ February 28, 2006: Message edited by: Peer Reynders ]
I agree. Here's the link:
subject: JAXB in eclipse
jQuery in Action, 3rd edition