Skip to main content

JAXB 2.0 overall question

4 replies [Last post]
sekhar
Offline
Joined: 2003-06-25
Points: 0

This request is from brian@pontarelli.com on jaxb interest list users@jaxb.dev.java.net. My comments are interleaved with the original email.

Orginal request - I've been reading through the specification a bit and also playing around with the JAXB 2.0 early release and I just had a few questions in general.

1. It seems that the specification is still mostly making references to interfaces, implementations, etc. which are no longer used in JAXB 2.0 as far as I can tell from playing around with the implementation. Is there a more recent specification than the Early Draft Release from July 2004?

A later draft version of JAXB 2.0 is currently being worked on in the JAXB 2.0 Expert Group. This version will be made available along with the Early Access Version of the RI.

With respect to the question on interfaces. Interfaces are indeed supported; they are just not the default. JAXB 2.0 also supports the binding of schema components to value classes.

By default schema components are bound to value classes.
To bind to interfaces, the generateValueClass must be set to "false" e.g.

Original Request 2. The JAXB compiler now generates POJOs (for all intents and purposes) that contain a bunch of annotations. The annotations seem to be what drives everything. What support will there be for using custom classes and enums rather than JAXB generated classes? It appears that if I annotate my classes and write a custom binding file I don't really need to use any JAXB generated classes, but I'm still forced to use the generated enums. Does that seem correct?

JAXB 2.0 annotation architecture is very much annotation driven. A major goal of JAXB 2.0 is mapping of POJO to XML. So you can start from Java with your own custom classes (instead of XML schema) and generate a schema or XML representation. Annotations can be used your own custom classes to customize the generated schema or the XML representation.

Original Request 3. The JAXB compiler is using annotations and classes that aren't in the javadoc, is there an update on that at all?

Thanks,
Brian Pontarelli

The published javadoc is an Early Access Draft Version 0.40. An updated version of javadoc will be available very soon.

Regards
Sekhar Vajjhala Sun Microsystems

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
voidmain
Offline
Joined: 2004-01-13
Points: 0

> JAXB 2.0 annotation architecture is very much
> uch annotation driven. A major goal of JAXB 2.0 is
> mapping of POJO to XML. So you can start from Java
> with your own custom classes (instead of XML schema)
> and generate a schema or XML representation.
> Annotations can be used your own custom classes to
> customize the generated schema or the XML
> representation.

Could you show me a simple example of using an external bindings file to unmarshal XML into my own custom classes and enums using JAXB 2.0?

kohsuke
Offline
Joined: 2003-06-09
Points: 0

I'm planning to write a blob entry about this in a near future. Stay tuned...

kohsuke
Offline
Joined: 2003-06-09
Points: 0
kohsuke
Offline
Joined: 2003-06-09
Points: 0

Correction:





should be: