-
January 10th, 2011, 01:25 PM
#1
XML Binding. JAXB in Eclipse Helios
I am using Eclipse Helios. I am trying to implement JAXB to parse XML data. I have read the tutorial at http://www.oracle.com/technetwork/ar...ex-140168.html (and many... many others). I have an XML schema file and I am trying to invoke the binding compiler to create the derived java objects from the XML schema file. I am stuck at the binding because the tutorial simply states to invoke the xjc from the command line. I can't figure out how to do this (It appears to me that the tutorial states "In order to bind and XML schema file you need to bind an XML schema file").
Here are my questions:
1. Do I need to download JAXB or is it already part of the JDK (it appears in the Java API at http://download.oracle.com/javase/6/docs/api/)
2. How/Where do I find/invoke the xjc? From within Eclipse? From the Windows command line?
3. What would the proper Eclipse syntax be? (The tutorial give an example for the Solaris OE).
4. Do the XML files need to be in the Eclipse project or are they stored externally (currently I have them in an external source)? When the xjc is invoked on the XML files will the derived classes be external as well, thus the need to compile the derived class files and include them in the project?
I have spent the majority of this week researching XML, XSD, DTD, StAX, SAX, and JAXB and haven't been able to come up with a step by step (I apologize for needing the hand holding) instructional that can connect the dots for me. This has my project grinding to a halt. For now I am switching gears to use CSV text files as a band-aid implementation. It will work, but then I don't learn anything new. What's the fun in that? =D
BTW this is my first post. I've been lurking in this forum for a long time and it seems that this community of programmers is by far more professional and courteous than other programming forums. So thank you in advance. I hope this will be a new knowledge base that I can contribute to in the future.
-
May 8th, 2011, 05:53 AM
#2
Re: XML Binding. JAXB in Eclipse Helios
Hi,
In Helios the plugin does not make the JAXB2.0 entry in the right click menu. You need to create a new Java Binding Project. If you copy the .xsd inside the project(any folder) and right click-> Generate-> JAXB Classes.
Sadly that did not work -> exception
BUT! if you create a package inside the <Binding project>\jaxb then copy the xsd to it--> the project generates the classes automatically in a default package. If you remove the xsd it will also remove the generated classes.
-
May 8th, 2011, 05:56 AM
#3
Re: XML Binding. JAXB in Eclipse Helios
Originally Posted by frostyandy2k
Hi,
In Helios the plugin does not make the JAXB2.0 entry in the right click menu. You need to create a new Java Binding Project. If you copy the .xsd inside the project(any folder) and right click-> Generate-> JAXB Classes.
Sadly that did not work -> exception
BUT! if you create a package inside the <Binding project>\jaxb then copy the xsd to it--> the project generates the classes automatically in a default package. If you remove the xsd it will also remove the generated classes.
This is a tutorial that gets you the plugin:
http://rocksolutions.wordpress.com/2...e/#comment-274
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|