Hello everybody,
I am new to this list and I have a question concerning castor's schema
model. I already posted it to the user list, but after reading through
your issue tracking system, I think it suits also here.
I use the schema model to generate schema definitions and I'm interested
in the capabilities creating schema with the specialization pattern
using the restriction element in combination with ComplexType,
ComplexContent, SimpleType. Generally that concerns the code generation
function of Castor and the question how Castor handles specialization
(subclass relations).
As far as I can see on the homepage supports the W3C XML Schema 1.0,
Second Edition Recommendation, where I can find my concern. Here my
example / intention:
<?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>
I have no problems to declare elements abstract and to define the
substitutionGroup, but building constructs with the structures mentioned
above don't work. So I wonder if it is possible at all to build such a
schema with Castor's XML Schema API? Regarding some entries/tickets in
your issue tracking system, Castor should understand these constructs to
generate Java source code. So I have hope that you can help me using the
API to create my schema.
Two articles that show my intention:
http://www.w3schools.com/schema/el_restriction.asp
http://www.mail-archive.com/dev@ castor.codehaus.org/msg00455.html
Best Regards,
Oliver
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email