http://www.oracle.com/technetwork/articles/javase/index-140168.html#binsch
The xjc binding compiler can be found in the Java 6 jdk1.6.0_XX\bin directory and is used to generate Java classes from an XSD:
xjc -p com.mycompany.model myschema.xsd -d targetDirectory
XSD with inline ParmList definition results in generated inner class:
[sourcecode language="xml"]
<xs:element name="DataHeader">
<xs:complexType>
<xs:sequence>
<xs:element ref="DataName"/>
<xs:element ref="DataTimeStamp"/>
<xs:element name="ParmList" minOccurs = "0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="ParmName" type="xs:string"/>
<xs:element name="ParmValue" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
[/sourcecode]
xjc Binding Compiler generated class:
public class DataHeader
protected List<DataHeader.ParmList> pList;
public static class ParmList {
protected String parmName;
protected String parmValue;
XSD with separate ParmList definition with reference in DataHeader generates two separate classes:
[sourcecode language="xml"]
<xs:element name="ParmValue">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:element>
<xs:element name="ParmName"> ...
<xs:element name="ParmList">
<xs:complexType>
<xs:sequence>
<xs:element ref="ParmName"/>
<xs:element ref="ParmValue"/> ...
<xs:element name="DataHeader">
<xs:complexType>
<xs:sequence>
<xs:element ref="DataName"/>
<xs:element ref="ParmList" minOccurs="0" maxOccurs="unbounded"/> ...
[/sourcecode]
xjc Binding Compiler generated classes:
public class DataHeader
protected List<ParmList> plist;
public class ParmList
protected String parmName;
protected String parmValue;