How to quickly generate an XSD (XML Schema Definition) based on a Java Class Model using JDeveloper 11g

In the course of my current studies into XSD (XML Schema Definition) and how to convert from XSD to Java Class and vice versa as well as to Database Design vv. I ran into a very simple way of creating an XSD document based on Java Class definitions. With a very simple piece of code, you can generate the XSD document in no time at all, using JDeveloper 11g and its JAXB libraries. Note: the code presented in this article will work in any environment that has the JAXB libraries available.

In my example, I have a small class model:

I ensure that two libraries are associated with the JDeveloper project: JAXB and JEE 1.5:

Now the following class can be used to generate the XSD document derived from this class model: