Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAXB in eclipse

 
bhargavi kakarala
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

jaxb\lib\jaxb-api.jar
jaxb\lib\jaxb-impl.jar
jaxb\lib\jaxb-libs.ja
jwsdp-shared\lib\relaxngDatatype.jar
jwsdp-shared\lib\xsdlib.jar

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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic