users@jaxb.java.net

Re: [JAXB 2.0] Grammar objects

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Tue, 26 Apr 2005 07:53:51 -0700

Aleksei Valikov wrote:
> My biggest concern is grammar model which was implemented in 1.0 by
> com.sun.msv.grammar and com.sun.tools.xjc.grammar packages. Various
> expressions (like SequenceExp) and items (like FieldItem) describe the
> schema which is expressed by the classes generated by JAXB. Processing
> these structures (for instance, with visitors) I could generate
> schema-driven artifacts such as object verifiers.
>
> Unfortunatelly I failed to find the analog of schema grammar model in
> 2.0.

That is correct. The grammar model in 1.0 was much more expressive than
that in 2.0. 1.0 code generators were generally capable of taking a more
expressive model, but in 2.0 it can no longer do so. Hence the change in
the model.

> What I have is primarily CClassInfo/CPropertyInfo - I can see,
> which properties made up a certain class, but what was the schema
> structure that produces it? Was it a sequence or a choice or a more
> complex construct?
> HyperJAXB can be ported without this information, but jaxb-verification
> and a new hijack project (not public yet) need to take schema grammar
> into an account.

I see.

One possibility is to link those classes and properties back to XSOM
objects. Like this:

class CPropertyInfo {
        public final XSComponent source
        ...
}

Does that give you enough hook for jaxb-verification?

>
> Basically, I need a hint on how to implement something like the attached
> CheckVisitor.
>
> Thanks!
>
> Bye.
> /lexi
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com