Which is a very good idea, as that will be more or less the core functionality. Don't forget that - at one point in time - you will have to look into JAXB annotations as well. Here's why:
a) First, they are JAXB-specific, and as such, Castor does not support them right now. b) They carry semantic meaning, potentially modifying default asumptions during schema generation. Please bear in mind that we are going to need a little 'infrastructure' to be able to read those annotations as well. I am not 100% whether this is part of your assignment or not, as there's some overlap with another GSoC student. In other words, that's to be defined. Just for your information, Cstor already now has a component that we name externally 'xml schema instance 2 schema' convertor. It is a little tool that you can use to derive an XML schema from an XML instance document. Not exactly what you are looking for, but at least it makes use of the very same infrastructure (schema.* classes, SchemaWriter, etc.). Regards Werner Sachith Dhanushka wrote: > Hi, > > Thanks for the clarification. Yes, I also didn't want to hack the > existing JAXB code. I will first start with looking in to extracting > schema information from JAXB classes. > > Thanks, > SD > > On 5/13/07, *Werner Guttmann* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Hi, > > please see inline. > > Werner > > Sachith Dhanushka wrote: > > Hi Werner and all, > > > > Finally I can now start the project :) > > > > Anyway, I looked more deeper in to what I have to do and these are > some > > initial ideas. Please help me to clarify these. > > > > 1. The basic idea is to look at a set of JAXB2 generated classes and > > from that gather information, pump them in to Castor to generate code. > > So what I thought was to create an instance of > > org.exolab.castor.xml.schema.Schema object and populate it from the > > information extracted from JAXB2. > Yes and no. The idea is to assess a collection of Java classes > (annotated with JAXB annotations), and create a schema convertor that is > capable of creating an XML schema instance from those classes. There's > the JAXB specification that has a longish section about this schema > converter, and we simply need to meet those requirements. > > Basically, that converter needs to be able to read on those Java > classes, and build a Schema instance from it, based upon the semantics > as defined by the Java model and the JAXB annotation. As you have > already figured, Castor already has Java classes that we use internally > to represent XML schema information. These classes are used during > source code generation, for reading in an XML schema from e.g. a file. > Part of your task package will be to use these classes (and expand them > as required) to build an in-memory representation of an XML schema, and > eventually serialize it to a file. > > > This Schema object can be fed in to > > Castor source generator to generate java sources. The method I am > > looking to hook this is SchemaGenerate.generateSource(final Schema > > schema, final String packageName)+ > This is the other way around, Java code generation from an XML schema, > and that part is *not* within scope for you. > > > > 2. JAXB2 comes with a java-to-schema converter. I didn't look at it > > much, but I think I can either > > I. hack in to that and plugin castor Schema object to get it > populated or > > II. let it generate a schema and pump it in to SchemaGenerate in > Castor. > I don't think hacking into the JAXB schema convertor is actually anm > option. In order to offer JAXB 2.0 compliance for Castor XML, Castor > needs to have its own schema convertor that meets the requirements as > set our by the JAXB specification. > > > So these are the paths that I will be exploring to achieve the goal. > > Please help me to refine these ideas and to achieve what you > wanted to > > achieve from this project. > > > > Thanks, > > SD > > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email