Difference between revisions of "EclipseLink/UserGuide/MOXy/Generating Java Classes from an XML Schema"

From Eclipsepedia

Jump to: navigation, search
Line 6: Line 6:
 
}}  
 
}}  
  
= Generating Java Classes from an XML Schema =
+
=Generating Java Classes from an XML Schema=
  
 
Use the '''JAXB Compiler''' to generate Java classes from an XML schema. The generated classes will contain JAXB annotations that represent the XML binding metadata.  
 
Use the '''JAXB Compiler''' to generate Java classes from an XML schema. The generated classes will contain JAXB annotations that represent the XML binding metadata.  
  
== Running the JAXB Compiler ==
+
==Running the JAXB Compiler==
  
 
Use the '''.sh''' or '''.cmd''' file to run the JAXB compiler:  
 
Use the '''.sh''' or '''.cmd''' file to run the JAXB compiler:  
  
<ECLIPSELINK_HOME>/eclipselink/bin/jaxb-compiler.sh <source-file.xsd> [-options]
+
<source lang="dos">
 +
<ECLIPSELINK_HOME>/eclipselink/bin/jaxb-compiler.sh &lt;source-file.xsd&gt; [-options]
 +
</source>
  
or
 
  
 +
<source lang="dos">
 
  &lt;ECLIPSELINK_HOME&gt;\eclipselink\bin\jaxb-compiler.cmd &lt;source-file.xsd&gt; [-options]
 
  &lt;ECLIPSELINK_HOME&gt;\eclipselink\bin\jaxb-compiler.cmd &lt;source-file.xsd&gt; [-options]
 +
</source>
 +
  
 
This table describes the available JAXB Compiler options:  
 
This table describes the available JAXB Compiler options:  

Revision as of 11:25, 17 March 2011

EclipseLink MOXy

link="http://wiki.eclipse.org/EclipseLink"
EclipseLink
Website
Download
Community
Mailing ListForumsIRC
Bugzilla
Open
Help Wanted
Bug Day
Contribute
Browse Source


Generating Java Classes from an XML Schema

Use the JAXB Compiler to generate Java classes from an XML schema. The generated classes will contain JAXB annotations that represent the XML binding metadata.

Running the JAXB Compiler

Use the .sh or .cmd file to run the JAXB compiler:

<ECLIPSELINK_HOME>/eclipselink/bin/jaxb-compiler.sh &lt;source-file.xsd&gt; [-options]


 &lt;ECLIPSELINK_HOME&gt;\eclipselink\bin\jaxb-compiler.cmd &lt;source-file.xsd&gt; [-options]


This table describes the available JAXB Compiler options:

JAXB Compiler options
-d <directory> Specifies the output directory for the generated files.
-p <package> Specifies the target package
-classpath <arg> Specifies where to find user class files
-verbose Enables the compiler output
-quiet Disables the compiler output
-version Displays the compiler version information


For example:

jaxb-compiler.sh -d jaxb-compiler-output config/Customer.xsd

To display a complete list of compiler options, use:

jaxb-compiler.sh -help

Eclipselink-logo.gif
Version: 2.2.0 Draft
Other versions...