Hi Steven,

Thanks for the clarification. I also agree with you, but what I can not
understand is what JAXB2 generated classes are doing.

Please look at the attached books schema and the corresponding
BookType.Promotion class.

My problem is how can I look at BookType class and decide Promotion element
as a choice? For the time being the code I wrote identify that as a sequence
with minOccurs=0.

Thanks,
SD

On 6/24/07, Steven Dolg <[EMAIL PROTECTED]> wrote:

Hi Sachith,

a Choice is used to select 1 of n available options (when maxOccurs=1) or
to select m of n available options (when maxOccurs>1).

Your description of the class implies that all properties might be missing
but also all properties might be set.
So a Choice with maxOccurs=1 won't fit (since a maximum of one
property can be set).

I also understand that each property can occur only once.
So a Choice with maxOccurs>1 won't fit either (since one can chose any
option more than once).


So this must be a sequence where every element has minOccurs=0.



Hth,
Steven

----- Original Message -----
*From:* Sachith Dhanushka <[EMAIL PROTECTED]>
*To:* dev@castor.codehaus.org
*Sent:* Sunday, June 24, 2007 1:58 AM
*Subject:* Re: [castor-dev] Approaches for Schema Generation

Hi,

I uploaded a basic
implementation as I promissed earlier in to CASTOR-2016. Werner, please be
kind enough to
review the code and provide me with some feedback. In the mean time I will keep 
on improving the code.


I have a small question on schema handling.

There is a JAXB2 annotated class which has set of non-requried properties
(REQUIRED=false). All the properties that this class has are non-required. 
Should these properties included under Choice or under sequence with 
minOcurrs=0? This is bit of a tricky question for me as the annotations are not 
helping me here. I appreciate if some one can help me to resolve this problem.


Thanks,
SD


On 6/21/07, Sachith Dhanushka <[EMAIL PROTECTED]> wrote:
>
> Hi Werner,
>
> Thanks for the answer. So I won't use any JAXB2 RI code.
>
> I am now working with JAXB2 reflection library found in 
https://jaxb2-reflection.dev.java.net/
> and creating Castor model. Will post my initial bit of code soon.
>
> Thanks,
> SD
>
> On 6/20/07, Werner Guttmann < [EMAIL PROTECTED]> wrote:
> >
> > Sachith,
> >
> > your task is to come up with a solution that adds certain
> > functionality
> > to Castor to make it (or parts thereof) JAXB compliant. In the context
> > of this statement, JAXB compliance refers to the specification.
> >
> > Clearly, it cannot be as simple as taking parts of the JAXB reference
> > implementation and integrate it with Castor. There's plenty of issues
> > with this approach, which I should not have to explain to you, one of
> > them being licensing.
> >
> > Yes, nobody wants to re-invent the wheel, but simply pulling parts of
> > the JAXB RI into Castor is not an option.
> >
> > Regards
> > Werner
> >
> > Sachith Dhanushka wrote:
> > > Hi Werner and all,
> > >
> > > This is what I am trying to do now. As I commented in the JIRA also,
> > now
> > > I am using the java.net <http://java.net> jaxb2 reflection library
> > > instead of annongen Jam. So I am working on that now.
> > >
> > > In addition to that please let me know the feasibility of the
> > following
> > > approach as well. When I looked in to JAXB2 schema generation, I can
> > use
> > > the existing JAXB2 RI to get a DOM model of the schema. In other
> > words,
> > > we can give set of JAXB annotated classes and get the schema as a
> > DOM
> > > model. Then we can create our Castor schema model by looking at the
> > DOM
> > > model. The problem with this approach is that we get an intermediate
> > DOM
> > > object model. But the advantage is this approach is that this is
> > less
> > > error-prone and standard as we can use the implementation from the
> > JAXB
> > > RI itself.
> > >
> > > Please let me know what you think about this approach.
> > >
> > > Thanks,
> > > SD
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >      http://xircles.codehaus.org/manage_email
> >
> >
>

Attachment: books.xsd
Description: Binary data

Attachment: BookType.java
Description: Binary data

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

    http://xircles.codehaus.org/manage_email

Reply via email to