cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin" <>
Subject Schema generation issues
Date Thu, 02 Jul 2009 16:59:10 GMT

I have problems with the JAXB schema generation.

Consider this bean :

@XmlRootElement(name="thebook", namespace="http://books")
public class Book {
  private int id;
  public Book() { }
  public int getId() { return id; }
  public void setId(int ident) { id = ident; }

JAXBContext generates these 2 schemas :

<!-- Schema 1 -->
<xs:schema xmlns:xs="" version="1.0" targetNamespace="http://books">
<xs:import schemaLocation="schema2.xsd" />
<xs:element name="thebook" type="book" />

<!-- Schema 2 -->
<xs:schema xmlns:xs="" version="1.0">
<xs:complexType name="book">
<xs:element name="id" type="xs:int" />

The first problem I guess is to check if <import> in the first schema has no 'namespace'
attribute in which case I can have 
'book' complex type injected directly into the first schema. with the whole <import>
being removed. It can get quiote hairy if 'book' type improts some other types, but it can
be handled.

What I'm sure about is how to figure out that when we have say a method

public Resource() {
   public Book getBook() {}

then how to ensure that Book is represented by {http://books}thebook qualified name in the
generated doc such as wadl...

it's not obvious to me how a link between Book and 'thebook' element can be established given
that this info (in XmlRootElement at the moment) may come from various sources

thanks, Sergey
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message