Hello Werner,

thanks for answering and getting into my problem.

Werner Guttmann schrieb:
Oliver,
Castor's internal 'schema' classes definitely support all concepts mentioned by 
you. But you have to have an awareness that most of these concepts are used 
mainly for reading in XML schemas during source code generation.
Yes I understand that. In my case I generate XML Schema from the scratch (on the basis of an ontology based class model) and my goal is to express subclass behavior (specialization *) in the Schema world. In the next step I enter the Java world to implement defined webservices.
*) http://www.xfront.com/ElementHierarchy.html
http://www.xfront.com/composition-versus-subclassing.html

I can see, that the SourceGenerator can build java classes that extend others:
   public class B extends ex.A

What I need is an extension of the Schema Class to use Java for building XML Schemas whose translation result in these Java Class definitions. I am really happy with the Castor API and I would like to use it during all steps that deal with XML Schema. Cause using the Schema definition to define Webservices I am also really encouraged and motivated by the fact that Castor and Axis work together. By the way, in the current German Javamag. you can find an article on this topic: "Castors new half-brother" :-).

CodeGen (castor-user):
I practice with the CodeGen, but until now, I'm not able to build a working reference schema example (on the basis of the posted schema), that generates a suitable Java package without errors. I also don't have any experience with the needed binding file. So I would be really pleased, if somebody could support me with this!


I noticed that the CodeGenerator indicates loops in the schema. Can I use this functionality stand alone? I have to dump XPaths - so that would help. Also regarding that I have to generate the binding files in the future.
In other words, it might be that we have to add code to the schema writer to 
'enable' correct behaviour for some of these concepts. Afaik, the SchemaWriter 
component is mainly used to convert an XML instance to an XML schema.
I'm not sure, if you have to extend the SchemaWriter. I'm not deadlocked on my example and you said that Castors internal Schema understand these concepts anyway. I'm searching a way to express and build subclass properties in XML Schema. I assume that an extension of the Schema would solve my requirement ;-) I don't see any other solution that let me automatically generate XML Schema.

Does this make any sense to you ?
Yes. ;-)

Best regards,
Oliver

Werner

-----Ursprüngliche Nachricht-----
Von: Oliver Fourman [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 02. März 2007 11:33
An: [email protected]
Betreff: [castor-dev] Using castors schema model to build xml schema with
restrictions (specialization pattern)

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

Reply via email to