users@jaxb.java.net

Re: Bindings documentation

From: Sekhar Vajjhala <sekhar.vajjhala_at_sun.com>
Date: Wed, 02 Jul 2003 07:26:27 -0400

Hank Ratzesberger wrote:

> Ed,
>
> Thank you. I had not seen the tutorial pages before
> and they are very helpful.
>
> I would still like a tip. I am using a supplied schema
> (iso 19115) and it has type and element declarations
> like _DQ_Quality and DQ_Quality. As the default is to
> remove "_" from identifiers, the result is namespace
> collision.
>
> I don't want to annotate these files, is there a
> shortcut way to keep "_" in identifiers, or do I
> need to build a custom binding for each of these
> classes?

Keeping the _ is one way to resolve the name collision. Ryan
already pointed out the underscoreBinding customization which
can be used for this.

Another way to resolve the name collision is to use the nameXMLTransform
customization in <schemaBindings>.This allows a suffix and/or prefix to be
associated on a per symbol basis. The suffix and/or prefix is applied first
to transform the XML name before the XML-> Java name mapping is done.
So a different suffix and/or prefix with type declarations and element decls
(since they are in different symbol spaces). Even when the _ is dropped, name
collisions will be resolved since the generated Java names will be different.

Example:
<schemaBindings>
     <nameXMLTransform>
            <typeName suffix="Type"/>
            <elementName suffix="Element"/>
    </nameXMLTranform>
</schemaBindings>

The above appends "Type" to all type declarations and "Element" to all
element declarations. nameXMLTransform is a single customization that needs
to
be done once for a given schema ( it is scoped to the schema unlike
underscoreBinding which has global scope and applies to all schemas ).

Sekhar Vajjhala
Sun Microsystems


>
> Best regards,
> Hank
>
> ----- Original Message -----
> From: "Ed Mooney" <Ed.Mooney_at_Sun.COM>
> To: <JAXB-INTEREST_at_JAVA.SUN.COM>
> Sent: Monday, June 23, 2003 1:47 PM
> Subject: Re: Bindings documentation
>
> > Hi Hank,
> >
> > There's the bindings schema: http://java.sun.com/xml/ns/jaxb/. There's
> > also Chapter 6 of the spec (http://java.sun.com/xml/downloads/jaxb.html)
> > and Chapter 10 of the Tutorial
> > (http://java.sun.com/webservices/docs/1.1/tutorial/doc).
> >
> > Regards,
> > --
> > Ed Mooney |Sun Microsystems, Inc.|Time flies like
> > Java Web Services |UBUR02-201 |an arrow, but
> > Ed.Mooney_at_Sun.COM |1 Network Drive |fruit flies like
> > 781-442-0459 |Burlington, MA 01803 |a banana. Groucho
> >
> > Hank Ratzesberger wrote:
> > > I am having trouble finding complete specification
> > > for the bindings file. WSDL only has one example
> > > program demonstrating the .xjb binding file.
> > >
> > > Can someone provide me a link?
> > >
> > > Thank you,
> > > Hank
> > >
> > > ============================================
> > > Replying to a list? I'll get my copy there!
> > >
> > > Hank Ratzesberger
> > > Institute for Crustal Studies
> > > University of California, Santa Barbara
> > > ============================================
> >