I have an xml file that looks like this:
<RootItem>
<Items>
<Item />
<Item />
<Item />
</Items>
<Values>
<Value />
<Value />
<Value />
</Values>
<AnotherItem />
</RootItem>
I'm using Trang to translate this into a .xsd schema, and using xjc to translate the schema into annotated Java classes (that work smoothly with jaxB to marshal and unmarshall my documents) My only problem is that xjc gives me these classes:
- RootItem.java
- Items.java
- Item.java
- Values.java
- Value.java
- ObjectFactory.java (required by JaxB)
I don't want a "Items" or a "Values" class. How do I format my schema to tell it to ignore the parent element and just make a "List items" object in my RootItem class?
What I want:
- RootItem.java
- Item.java
- Value.java
- ObjectFactory.java (required by JaxB)
Thanks!
Edit: Here's the schema generated by Trang:
<xs:element name="RootItem">
<xs:complexType>
<xs:sequence>
<xs:element ref="Items"/>
<xs:element ref="Values"/>
</xs:sequence>
<xs:element name="AnotherItem" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
<xs:element name="Items">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="Item"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Values">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="Value"/>
</xs:sequence>
</xs:complexType>
</xs:element>