I would like to have this behaviour : a complex element has got some elements (so it does not contains a sequence) but some of these elements have got "minoccurs" and/or "maxoccurs" defined. I tried to build such a file, and it looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="nom_site">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="3" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nom_type">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="2" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="sites">
<xs:complexType>
<xs:all>
<xs:element name="site">
<xs:complexType>
<xs:all>
<xs:element ref="nom_site"></xs:element>
<xs:element name="délai" type="xs:int"></xs:element>
<xs:element name="expéditeur" type="xs:string"></xs:element>
<xs:element name="message" type="xs:string"></xs:element>
<xs:element name="types" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element name="type">
<xs:complexType>
<xs:all>
<xs:element ref="nom_type"></xs:element>
<xs:element name="message" type="xs:string"></xs:element>
<xs:element name="libellés" minOccurs="0"
maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element name="libellé">
<xs:complexType>
<xs:all>
<xs:element name="nom_lib" type="xs:string"></xs:element>
<xs:element name="message" type="xs:string"></xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
but eclipse raise an error : under the "all" item, the cardinalities can only be "0" or "1"...
if my element connot contains "sequence" or "all", is there something else possible?
thanks,
olivier
I've loaded this into xml spy and it is valid and well formed according to that. Can't see any particuler issues.
Generates sample of:
So some issue with eclipse or the way you are using the xsd maybe?