Sebastien, you may find it helpful to read up on XML Schema, or at least have a good reference on hand; it really is necessary to have a sound understanding of it whether you're working with JAXB or XMLBeans. A lot of people needing to understand XML Schema because they work with WSDL or other things that use it don't bother to acquire even a basic understanding of XML Schema. A sequence is a group of elements that must appear in that order. If the elements can appear in any order, don't use a sequence. If you have <xs:sequence> <xs:element name="presentationURL" type="xs:string" minOccurs="0"/> <xs:any namespace="##other" minOccurs="0"/> </xs:sequence> that means that presentationURL must appear first, if it does, followed by zero or one of any element just not in the target namespace. - Wing Yew
_____ From: Sebastien Dionne [mailto:survivan...@gmail.com] Sent: Wednesday, December 30, 2009 11:26 AM To: user@xmlbeans.apache.org Subject: Re: jaxb to xmlbeans : xmlbeans fail on xs:any thanks. I was not suspecting a problem with Xmlbeans, is just that Jaxb didn't generate error, so I assumed that it was valid some how. I was able to fix the problem by replacing : <xs:all> ... <xs:element name="presentationURL" type="xs:string" minOccurs="0"/> </xs:all> <xs:anyAttribute namespace="##other" processContents="skip"/> by <xs:sequence> <xs:element name="presentationURL" type="xs:string" minOccurs="0"/> <xs:any namespace="##other" minOccurs="0"/> </xs:sequence> but I don't know if there will be side effects. I hope that I didn't broke the order.. I had to be order less. is it OK ? 2009/12/30 Wing Yew Poon <HYPERLINK "mailto:wing.yew.p...@oracle.com"wing.yew.p...@oracle.com> It is not weird. And there is nothing weird with XMLBeans. The XMLBeans error tells you exactly what the problem is. If you encounter an error from XMLBeans, I'd advise you to first look to see what you may be doing wrong, instead of thinking XMLBeans is doing something wrong. In this case, your schema is invalid. You cannot have an xs:any in an xs:all group, only xs:element (and xs:annotation). An xs:all group is used to indicate that elements should appear in any order, but no more than once each. It can only contain element declarations and references. - Wing Yew _____ From: Sebastien Dionne [mailto:HYPERLINK "mailto:survivan...@gmail.com" \nsurvivan...@gmail.com] Sent: Wednesday, December 30, 2009 9:30 AM To: HYPERLINK "mailto:user@xmlbeans.apache.org" \nu...@xmlbeans.apache.org Subject: Re: jaxb to xmlbeans : xmlbeans fail on xs:any it wierd.. even jaxb is not able to recompile it. 2009/12/30 Sebastien Dionne <HYPERLINK "mailto:survivan...@gmail.com" \nsurvivan...@gmail.com> hello I used jaxb to generate schema from java source and now I'm trying to regenerate java with xmlbeans but it failed on this line <xs:any processContents="lax" maxOccurs="unbounded"/> if I remove this line it will compile. there is something wierd with xmlbeans ? <xs:complexType name="DeviceType"> <xs:all> <xs:element name="deviceType" type="xs:string"/> <xs:element name="friendlyName" type="xs:string"/> <xs:element name="manufacturer" type="xs:string"/> <xs:element name="manufacturerURL" type="xs:string" minOccurs="0"/> <xs:element name="modelDescription" type="xs:string" minOccurs="0"/> <xs:element name="modelName" type="xs:string"/> <xs:element name="modelNumber" type="xs:string" minOccurs="0"/> <xs:element name="modelURL" type="xs:string" minOccurs="0"/> <xs:element name="serialNumber" type="xs:string" minOccurs="0"/> <xs:element name="UDN" type="xs:string"/> <xs:element name="UPC" type="xs:string" minOccurs="0"/> <xs:element name="iconList" type="tns:IconListType" minOccurs="0"/> <xs:element name="serviceList" type="tns:ServiceListType" minOccurs="0"/> <xs:element name="deviceList" type="tns:DeviceListType" minOccurs="0"/> <xs:element name="presentationURL" type="xs:string" minOccurs="0"/> <xs:any processContents="lax" maxOccurs="unbounded"/> </xs:all> <xs:anyAttribute namespace="##other" processContents="skip"/> </xs:complexType> [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] XmlBeans compile failed: xml ErrorLoading schema file C:\test\upnp-xsd-xmlbeans-jar\src\main\xsd\device. xsd xml ErrorC:\test\upnp-xsd-xmlbeans-jar\src\main\xsd\device.xsd:43:7: error: cvc- complex-type.2.4a: Expected element 'elem...@http://www.w3.org/2001/XMLSchema' i nstead of 'a...@http://www.w3.org/2001/XMLSchema' here in element a...@http://www. HYPERLINK "http://w3.org/2001/XMLSchema" \nw3.org/2001/XMLSchema xml ErrorLoading config file C:\test\upnp-xsd-xmlbeans-jar\src\main\xsdconfig\de vice.xsdconfig -- ------------- A+ Sébastien. Vous pouvez me suivre sur Twitter / You can follow me on Twitter : http://twitter.com/survivant -- ------------- A+ Sébastien. Vous pouvez me suivre sur Twitter / You can follow me on Twitter : http://twitter.com/survivant