I have the following xml element:
<experiment>
<name>Experiment</name>
<globalVars>
<var>
<name>foo</name>
<value>bar</value>
</var>
</globalVars>
<!-- ... -->
</experiment>
Your match in schema
is as follows:
<xs:element name="experiment">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element name="globalVars">
<xs:complexType>
<xs:sequence>
<xs:element name="var" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element type="xs:string" name="value"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
After executing the goal% maven% with%, the following classes are generated:
public class Experiment {
// ...
@XmlElement(required = true)
protected GlobalVars globalVars;
// ...
}
public class GlobalVars {
// ...
protected List<Var> var;
// ...
}
public class Var {
@XmlElement(required = true)
protected String name;
@XmlElement(required = true)
protected String value;
// ...
}
How do I make the jaxb2:xjc
class not be generated and instead only one instance instance variable is generated? I want the output to look something like this:
public class Experiment {
// ...
@XmlElement(required = true)
protected List<Var> globalVars;
// ...
}