Aleksei Valikov wrote:
> Hi.
>
> I'm currently working on an approach to produce help packages for
> schema-derived classes. The goal is to produce the set of HTML files
> describing, the semantics of XML Schema constructs (complex and simple
> types, elements and attributes) and, respectively, derived classes and
> their properties.
>
> Since the topic might be important to other JAXB users and developers,
> I'd like to share some of my thoughts and discuss the ideas. This
> primarily applies to JAXB 1.x, but is also relevant to 2.x.
>
Lexi,
Below are a couple of comments from the specification point of view. Hope
you find them helpful. Generally, Section 4 of the specification might
assist you in your task.
JAXB generates a Java package per target namespace in the schema.
generates a JAXB mapped class per complex type definition.
JAXB 1.0 did generate a class per global element declaration. No longer
true in JAXB 2.0 to generate less classes.
> JAXB generates class items consisting of zero or more fields. Fields
> might be either single (0..1) or collections (0..N). There are six
> significant types of fields:
> * primitive;
> * enum;
> * DOM;
> * wildcard;
for jaxb 2.0, Either wildcard attribute or
could be collection containing wildcard content of xml elements..
JAXB 1.0 did not support wildcard attribute at all.
> * complex;
Not sure what is meant by complex. Does this mean by reference as to
opposed to by value?
> * heterogeneous;
If collection is annotated with @XmlMixed in JAXB 2.0, instances of
java.lang.String are marshalled as XML infoset text information
JAXB 1.0 did support instance of java.lang.String representing XML
infoset text information
See JAXB 1.0 Spec, Section 5.9.4 for binding of mixed content.
Also JAXB 1.0 bound fixed attribute to a constant. See Section 4.5.3 in
JAXB 1.0 spec.
-Joe
>
> Basic help pack should provide help for class items as well as for the
> contained fields.
>
> Class item help contains:
> * title;
> * description;
> * list of subelements;
> * list of containing types or elements (optional, if possible).
>
> Field help contains:
> * title;
> * description;
> * type or types;
> * cardinality.
>
> Lists of subelements, containing constructs and field types are
> hyperlinked to the referred items. Titles are taken from the
> user-provided language packs. Descriptions are taken from the
> user-provided XHTML files. All other items are derived from the JAXB
> grammar of the schema.
>
> A sample help file from one of my previopus projects might be found here:
> http://nokis.baw.de/editor/help/en/nokis/record.html
>
> HTML files for help are generated in a two-step process.
> On the first step, JAXB add-on (or annotation processor for 2.0)
> produces an XML representation of the grammar. This is a very simple
> definition which describes class items, contained fields and their types.
> On the second step, grammar XML together with language packs and
> user-provided descriptions is processed by the XSLT transformation
> which finally produces (X)HTML files. Separating grammar extraction
> and HTML rendering allows adjusting presentation of the help packs
> without changing the code of the add-on.
>
> I was also considering XMI as the format for grammar XML. This has an
> added value of making schema-derived classes UML-ready, but XMI seems
> to be a bit overcomplicated for the task.
>
> 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
>