Sachith,

JAM definitely looks like worth looking at, especially as it allows to 
backbridge between Java 1.4 and Java 5.0 (and above). Though it should be quite 
clear that JAXB 2.0 by definition is Java 5.0 compliant.

The XMLInstance2Schema tool does not really help you, as you are right that it 
starts from an XML document instance, whereas your starting point is a set of 
(potentially annotated) Java classes plus as et of rules as defined in the JAXB 
2.0 specification.

But this input source difference aside, both 'tools' build an internal Schema 
object hierarchy, based upon the schema.* classes already available in Castor 
XML. And both have the requirement to serialize this assembled object hierarchy 
to e.g. a file, and that's where Castor already has existing infrastructure 
code (e.g. SchemaWriter, ...). In other words, reviewing what 
XMLInstance2Schema does internally might give a good understanding as to how to 
go about two thirds of your assigned task. And it will be very useful to get a 
full appreciation of the existing classes in the schema package, whether they 
are complete in terms of what you will need, etc.

The exact scope of your project is to implement the schema generator, a 
component that takes (potentially annotated) Java classes and generate an XML 
schema from it. For this, you will have to be able to process JAXB specific 
annotations, and customize your internal schema model before serializing it. In 
other words, your statement

        "What I meant by implement is to read and understand all the java 
        files thru reflection together with the annotations (perhaps using JAM) 
        and derive the schema by looking at it?"

is quite an accurate description of the task. Personally, you will have to 
cover JAXB annotation as well, but there's a lot of default rules that apply 
without looking in to annotations.

A few lines above, I pointed out to you that Castor already has a component 
that is capable of producing an XML schema instance., though it starts from a 
different input source (XML document instance). But as a result of this, 
there's already some infrastructure in place (whether feature-complete or not) 
that you will be re-using.

And finally, I don't think you'll be having a tough time. There's plenty of 
people you can turn to, incl. myself, and fortunately, you don't have to 
reinvent the wheel completely.

Let me know whether this clears things up a bit for you.

Regards
Werner
_______________________________________
Von: Sachith Dhanushka [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 16. Mai 2007 06:05
An: dev@castor.codehaus.org
Betreff: Re: [castor-dev] Clarification on JAXB2 -> Schema conversion


Hi,


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.

I was initially thinking of using JAM (http://annogen.codehaus.org/) for this. You
 were talking about another SoC project on this. Is it completed or going with 
me in parallel. If it is going with me in parallel, then I don't think it is a 
good idea to depend on it, from my project point-of-view. 

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.).

I am still confused how this can help me. IIUC, this will generate a schema looking at a XML file. Were you trying to say this, XML -> schema conversion is almost same as Java -> Schema conversion?
 

Anyway, I looked a bit more in to the project. In a nutshell do you think my 
project is to implement JAXB2 annotations? What I meant by implement is 
to read and understand all the java files thru reflection together with the 
annotations (perhaps using JAM) and derive the schema by looking at it? 
(BTW, the idea of hacking existing code of JAXB2 might not be a good idea as I 
think it involves some licensing issues which I am not that familiar to deal 
with.)
Please let me know whether the path that I am taking is correct and also please 
provide me with alternatives and suggestions if any. I already started reading 
JAXB 2.0 spec. Seems I have some tough time ahead :)

Thanks,
SD


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

    http://xircles.codehaus.org/manage_email

Reply via email to