Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes XML and Related Technologies and the fly likes JAXB 2.0 compiler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXB 2.0 compiler" Watch "JAXB 2.0 compiler" New topic
Author

JAXB 2.0 compiler

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
I am trying to use the JAXB 2.0 compiler to generate java classes for my schema.

But the compiler only seems to emit out the java classes for the types defined -and not the elements.
I believed that the xjc compiler emits out the elements as Impl classes.

The schema is as follows:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="catalog" type="catalogType"/>
<xsd:complexType name="catalogType">
<xsd:sequence>
<xsd:element ref="journal" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="section" type="xsd:string"/>
<xsd:attribute name="publisher" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="journal" type="journalType"/>
<xsd:complexType name="journalType">
<xsd:sequence>
<xsd:element ref="article" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="article" type="articleType"/>
<xsd:complexType name="articleType">
<xsd:sequence>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="author" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="level" type="xsd:string"/>
<xsd:attribute name="date" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>
chinna talluru
Greenhorn

Joined: Jul 23, 2006
Posts: 24
true man. when i used jaxb2.0 recently i faced the same problem.
it didnt generated java class for simple element which is given below.

<xsd:element name="age" type="xsd:int"/> for this element i didnt get
java class. but in sun eg he is given the classs for the element.

still now i didnt get reason for that from this forum
 
GeeCON Prague 2014
 
subject: JAXB 2.0 compiler