Manage this page

1. My working notes on jaxb

2. Display

Prerequisites

1. My Eclipse FAQ on this site

2. Eclipse Notes for jdk 1.5 on the eclipse site

3. jdk 1.5 enhancements

4. xsd refresher

Tutorial Assets

1. xml file

2. xsd file

3. Java classes

4. Driver class

Immediate References

jaxb 2.0 api

Search the mailing list

Online XSD validator

jdk 1.5 apis

Downloads

jaxb 2.0 home

jaxb 2.0 download page

Understanding Annotations

jdk 1.5 annotations

jaxb 2.0 available annotations

Understanding attributes

Rolling your reflection

1. FieldInfo class

2. BeanInfo class

3. ReflectionUtils

Please note this is a very old tutorial. It is kept here just for reference.

Goal

  1. Realize the reflection based architecture of Jaxb
  2. Plan a sample project for exercising Jaxb
  3. Prerequisites
  4. Resources and how best to use them

Reflection based architecture

jaxb 2.x architecture supports metadata based marshalling and unmarshalling of xml. This makes xsd optional unlike the jaxb 1.x architecture

Tutorial Project

The project is a simple project where an xml file is marshalled and unmarshalled using jaxb 2.x. All of the files needed to accomplish this are provided on the right hand side of the menu.

Prerequisites

Because jaxb 2.x relies on reflection, you will need to get jdk 1.5. And also a development environment that works with jdk 1.5. See the pre-requisites menus on the right hand side to get some help on these pre-requisites. I have used the 3.1 release candidate of eclipse to work with jdk 1.5. Seem to work ok

You will also probably need to understand XSDs if you are planning on exploring options with XSDs.

Some tool like XML SPy might be helpful although not required. In the XSD links I have put a link for online xsd verifiers

How best to use the tutorial page

Using the the notes on eclipse, you may want to download and install 1.5 development environment. You will also want to read up briefly on what metadata is and how to use it to annotate your code.

The key to using jaxb 2.x effectively is to understand the metadata attributes. You can look these up in the jaxb java api. Sometimes the java api description is a bit terse. The best place to look up is the jaxb mailing list. For convenience I have placed a search link for the news groups.

While working with the tutorial you will also need java api links for jaxb and jdk. I have placed these links as well on the control pages.

In short everything you need to work with this tutorial is included in the links here. Just keep this browser page open in the background when you are developing your tutorial and you will have everything you need in one place.

Check my working notes

I have a running notes that I have kept track of while I have developed and tested the solution. Use this link to read through to see if you run into similar things. You can use the feedback links, if you want to add your own things to it.

Bonus

I have included a section called "Rolling your own reflection". You are probably thinking why is this needed when I have so many tools that I can between xml and java. These classes goes to the core idea of how most of these tools work. Knowing that you can use the concept in a number of scenarios, including rolling your own jaxb 2.x like package to run on java 1.4.x. Why is that important, well a number of IT companies may take a while to go to jdk 1.5, rendering that option quite impractical. Under such cases you have the option of using Castor or something like this. The advantage of using this option, is your entire code is packaged as a jar file and no additional configuration files. You can also use this technology for mapping partial xml to java or binding non xml data to java.

Dr. Bing Yang - Tuesday, August 30, 2005 14:03:32

1. Eclipse Notes for jdk 1.5 link error

Dear Satya

The link to 'Eclipse Notes for jdk 1.5' is wrong, could you fix it and let me know please.

I desparatly need it to get your tutorial work on my machine.

Thanks.

Satya - Tuesday, August 30, 2005 10:15:14 AM

Dr. Bing Yang, Give me a few minutes ...

Dr. Bing Yang, Give me a few minutes. I will check it. Also if you are looking for something specific don't hesitate to leave a note here or email me at satya at activeintellect.com.

Feedback here is usually better though.

Just remember to put a

before each sentence in your feedback. You don't have to end it with a paragraph tag.

Satya - Tuesday, August 30, 2005 10:37:07 AM

I have fixed the jdk 1.5 links

Dr Bing Yang,

I have fixed the links for jdk 1.5. If you use the jdk 1.5 link, it will directly take you to the jdk 1.5 notes from the eclipse site.

You can also look at my faq page for eclipse. Especially go to the end of that page and you will see the download pages for 1.5 and a few more instructions and caveats on the 3.1 build of eclipse.

If you need further assistance on setting up eclipse for jdk 1.5 don't hesitate to post your questions here.

satya - Friday, August 31, 2007 2:55:59 PM

Search jaxb 1.x mailing list

Search jaxb 1.x mailing list

satya - Friday, August 31, 2007 2:56:38 PM

Search nabble forums

Search nabble forums