Re: jaxb to xmlbeans : xmlbeans fail on xs:any

Sebastien Dionne <[email protected]>
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <[email protected]>
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 <[email protected]>

>  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:[email protected]]
> *Sent:* Wednesday, December 30, 2009 9:30 AM
> *To:* [email protected]
> *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 <[email protected]>
>
>> 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 'element@
>> http://www.w3.org/2001/XMLSchema' i
>> nstead of 'any@http://www.w3.org/2001/XMLSchema' here in element all@
>> http://www.
>> w3.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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.