Thanks Werner for the helpful hints.

I was looking at Java2WSDL in a open source web services project. They were
trying to create a schema out of a given set of java classes, in the process
of creating the WSDL file. I took their code and was trying to port that to
Schema model in Castor. I did this for about 2 weeks now and
now I feel like I am wasting my time as that code is bit complicated
than requried.

So now I am changing my approach completely and I am starting to write it
from the scratch, dumping all the code and just taking some experience from
it.

I will be able to come up with a small working version by the end of this
week.

Just updating on the progress and what I am doing :)

Thanks,
SD

On 6/1/07, Werner Guttmann <[EMAIL PROTECTED]> wrote:

Sachith,

please see inline.

Werner

Sachith Dhanushka wrote:
> Hi,
>
> I am now digging in to Schema model to populate information from the
> JAXB classes. I am writing code to look at the JAXB generated classes,
> using JAM, and create a schema model. In the first pass I will not look
> at  the annotations. First pass will be to look at only the java object
> and dedude the schema. In the second phase, I will look at JAXB
> annotations and employ those information also to build the model. I have
> few questions in doing that.
>
> 1. Is there a code which already looks at a set of java classes and
> building a schema model? I am asking this as I do not want to re-invent
> the same thing.
Not to my knowledge. What is in place is classes like the Introspector
or the XMLMappingLoader that build Castor-internal descriptor classes
from a class file and/or a class mapping. Especially the Introspector
should be worthwhile to analyse. You might remember Joachim's email a
few days ago where he pointed out that it might be an option to create a
new kind of Introspector (specific to JAXB) that will be capable to
analyse Java code plus JAXB annotations and create an internal
descriptor from it (similar to what the current Introspector does).

In a second step, it should be pretty straight-forward to come up with
code that creates a hierarchy of objects from the schema package before
serializing this to a XML schema file.

> 2. Is there any aid like a document to learn a bit about schema model?
In pure therory, yes. Google for the XML schema primer. Castor-specific,
no, not really. But having worked on the code generation side myself for
quite some months now, it should be pretty straight-forward to map the
existing classes in the schema package to actual XML schema constructs.

> So far the only help was to look at the code in Marshallers and
> Un-Marshallers. I just want to know just the basics to make sure the way
I am using it correct.
Odd. I don't think that the (Un-)Marshaller uses any of these classes
(schema package). Those classes (such as ElementDecl and Schema) are -
to my knowledge - used in ...

a) the XML code gernator (aka source generator) to read an actual XML
schema fiel into a hierarchy of object instances of this package.

b) the XMLInstance2Schema tool that creates an XML schema from an actual
XML document instance.

Whilst none of these two use cases represent a full 'solution' to your
problem, both should clearly highlight the usage of these schema.*
classes.

>
> 3. When I was coding with JAM, I found same set of classes appearing
> inside castor also. What are these? Does that mean
> there is a similar code already in the code base?
Sorry, your question is not really clear to me.
>
> 4. Where will be my code go? Any suggestions for the module and java
> package name?
Any suggestions wrt to the package name ? There's alraedy an existing
SVN module, details of which I'll post in a few hours.

> Please help me to find answers to the above questions.
>
> Thanks,
> SD


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

    http://xircles.codehaus.org/manage_email


Reply via email to