JAXB / XJC - generate a class from XS:Group

thekhoavn2

New Member
I'm using JAXB for the first time and have some really bad XML that I can't change that I would like to generate classes for.The XML looks something like this:\[code\]<root> <contacts> <name>...</name> <phone>...</phone> <address>..</address> <name>...</name> <phone>...</phone> <address>..</address> <name>...</name> <phone>...</phone> <address>..</address> </contacts></root>\[/code\]So I thought ok, maybe I can refer to the contacts element as a sequence of groups. Relevant parts:\[code\]<xs:group name="Contact"> <xs:sequence> <xs:element name="name" type="xsd:string"/> <xs:element name="phone" type="xsd:string"/> <xs:element name="address" type="xsd:string"/> </xs:sequence></xs:group><xs:complexType name="ContactList"> <xs:sequence><xs:group maxOccurs="unbounded" ref="Contact"/></xs:sequence></xs:complexType>\[/code\]However, my ContactList object just has a getter that looks like:\[code\]public List<JAXBElement<?>> getContact()\[/code\]Why is a Contact object not declared, and how can I fix this? I don't think I can declare Contact as a complex type since it's not contained in an element.Thanks
 
Back
Top