Skip to main content

Should JAXB2 fully support XML Schema?

2 replies [Last post]
wangzaixiang
Offline
Joined: 2004-11-24
Points: 0

I am not sure if:

1. should JAXB2 fully support XML schema?
2. Can any xml schema (.xsd) mapped to java source(annotated)?
in JAXB1, the xjc may generate handler for the map, is it possible using JAXB2's annotation to map all the schema things to java?

also, in JAXB2, the xjc generated source code is still JAXB1 like, or just like the annotated POJO without handler class?

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohsuke
Offline
Joined: 2003-06-09
Points: 0

> also, in JAXB2, the xjc generated source code is still JAXB1 like, or just like the annotated POJO without handler class?

The latter. See http://weblogs.java.net/blog/kohsuke/archive/2005/02/technology_prev_1.html and http://weblogs.java.net/blog/kohsuke/archive/2005/02/using_jaxb_20_t.html for how the generated classes will look like.

sekhar
Offline
Joined: 2003-06-25
Points: 0

JAXB 2.0's goal is to support the mapping of all of XML schema features when starting from schema. A schema can be mapped to interfaces/impl classes or value classes/POJOS. The annotations are generated by the schema compiler.

The defaults have changed. In JAXB 1.0, by default XML schema constructs were bound to interfaces/impl classes but in JAXB 2.0, the default is value classes. To bind to interfaces/impl classes the following customization must be used:





Additionally, JAXB 2.0 also supports java -> schema mapping. JAXB 2.0 defined annotations can be used to customize the mapping and cover many of the commonly used XML schema constructs.