Hello list,

I started using castor's schema model to generate own schema definitions. Now I want to apply a specialization pattern to my definitions by using following schema elements: "restriction base", "complexContent" and the anonymous "simpleType". Today all my attempts were in vain.

I found some articles, that match my intention:
http://www.w3schools.com/schema/el_restriction.asp http://www.mail-archive.com/[email protected]/msg00455.html
http://jira.codehaus.org/browse/CASTOR-1238

So it is possible at all to build such a schema with Castor's XML Schema API?
Here my example: http://pastebin.com/891664 (highlighting)

Best regards,
Oliver

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:element name="A" type="A" abstract="true"/>
   <xs:element name="B" type="B" substitutionGroup="A"/>
   <xs:simpleType name="C">
       <xs:restriction base="xs:int"/>
   </xs:simpleType>
   <xs:simpleType name="D">
       <xs:restriction base="xs:string"/>
   </xs:simpleType>
   <xs:complexType name="A">
       <xs:sequence>
           <xs:element name="e1" type="C" maxOccurs="unbounded"/>
           <xs:element name="e2" type="D" maxOccurs="unbounded"/>
       </xs:sequence>
   </xs:complexType>
   <xs:complexType name="B">
       <xs:complexContent>
           <xs:restriction base="A">
               <xs:sequence>
                   <xs:element name="e1" maxOccurs="1">
                       <xs:simpleType>
                           <xs:restriction base="C">
                               <xs:enumeration value="1"/>
                           </xs:restriction>
                       </xs:simpleType>
                   </xs:element>
                   <xs:element name="e2" maxOccurs="2">
                       <xs:simpleType>
                           <xs:restriction base="D">
                               <xs:enumeration value="example"/>
                           </xs:restriction>
                       </xs:simpleType>
                   </xs:element>
               </xs:sequence>
           </xs:restriction>
       </xs:complexContent>
   </xs:complexType>
</xs:schema>


---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to