Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

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

(New page: Example: *http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JAXB/Compiler)
 
m
Line 1: Line 1:
Example:
+
{{EclipseLink_UserGuide
 +
|info=y
 +
|toc=y
 +
|eclipselink=y
 +
|eclipselinktype=MOXy
 +
|example=y
 +
|examples=* http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JAXB/Compiler
 +
}}
 +
 
 +
= 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 <source-file.xsd> [-options]
 +
 
 +
or
 +
 
 +
<ECLIPSELINK_HOME>\eclipselink\bin\jaxb-compiler.cmd <source-file.xsd> [-options]
 +
 
 +
This table describes the available JAXB Compiler options:
 +
 
 +
{| cellspacing="1" cellpadding="1" border="1" align="left" width="100%" summary="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
 +
|}
 +
 
 +
<br>
 +
 
 +
<br>
 +
 
 +
<br>
 +
 
 +
<br>
 +
 
 +
<br>
 +
 
 +
<br>
 +
 
 +
<br>
 +
 
 +
For example: <br>
 +
 
 +
  jaxb-compiler.sh -d jaxb-compiler-output config/Customer.xsd
 +
 
 +
<br>
 +
 
 +
To display a complete list of compiler options, use:
 +
 
 +
jaxb-compiler.sh -help
 +
 
 +
<br> {{EclipseLink_MOXy
 +
|next=[[EclipseLink/UserGuide/MOXy/Runtime|Runtime]]
 +
|previous=[[EclipseLink/UserGuide/MOXy/Overview/Annotations|Annotations]]
 +
|up=[[EclipseLink/UserGuide/MOXy/Overview|Overview]]
 +
|version=2.2.0 Draft}}
 +
 
 +
Example:  
 +
 
 
*http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JAXB/Compiler
 
*http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JAXB/Compiler

Revision as of 14:27, 27 December 2010

EclipseLink MOXy

Eclipselink-logo.gif
EclipseLink
Website
Download
Community
Mailing ListForumsIRCmattermost
Issues
OpenHelp WantedBug 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 <source-file.xsd> [-options]

or

<ECLIPSELINK_HOME>\eclipselink\bin\jaxb-compiler.cmd <source-file.xsd> [-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...

Back to the top