users@jaxb.java.net

Re: No concrete java class generated for a global element that references a global type

From: Dmitri Colebatch <dim_at_colebatch.com>
Date: Tue, 31 Jan 2006 09:17:36 +1100

Thanks Ed - I'll give it a go. One of these such schems is the SOAP
1.2 schema which we have unfortunately already had to tweak to make it
play happily with JAXB.

On another note - I believe that the JAXB RI, along with generated
SOAP schemas, are bundled with Tiger. Do you know what the
implications of this are on situations like this, where I want to
generate my own JAXB classes for the SOAP schemas?

thanks,
dim

On 31/01/06, Ed Mooney <Ed.Mooney_at_sun.com> wrote:
> Hi Dmitri,
>
> It occurs to me @generateElementClass is a better way to do what you want:
>
> <xsd:schema
> targetNamespace="urn:missingRootElement"
> xmlns="urn:missingRootElement"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> jaxb:version="2.0">
>
> <xsd:annotation>
> <xsd:appinfo>
> <jaxb:globalBindings generateElementClass="true"/>
> </xsd:appinfo>
> </xsd:annotation>
> <xsd:complexType name="MyComplexType">
> <xsd:sequence>
> <xsd:element name="InnerString" type="xsd:string"
> maxOccurs="unbounded" />
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:element name="MyElement" type="MyComplexType" />
>
> </xsd:schema>
>
> Regards,
>
> -- Ed
>
> Dmitri Colebatch wrote:
> > Hi all,
> >
> > I would swear that this has been asked in one way or another but I
> > must be searching for the wrong things. I have a schema like this:
> >
> > <xsd:schema
> > targetNamespace="urn:missingRootElement"
> > xmlns="urn:missingRootElement"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified">
> >
> > <xsd:complexType name="MyComplexType">
> > <xsd:sequence>
> > <xsd:element name="InnerString" type="xsd:string" maxOccurs="unbounded" />
> > </xsd:sequence>
> > </xsd:complexType>
> >
> > <xsd:element name="MyElement" type="MyComplexType" />
> >
> > </xsd:schema>
> >
> > and when I run xjc over it all I get is:
> >
> > parsing a schema...
> > compiling a schema...
> > missingrootelement\MyComplexType.java
> > missingrootelement\ObjectFactory.java
> > missingrootelement\package-info.java
> >
> > ie - there's no MyElement class.
> >
> > I suppose I'm asking two questions:
> >
> > 1. Is it possible to generate a MyElement class in the above example?
> > 2. What is the rationale behind not generating a MyElement class by default?
> >
> > cheers
> > dim
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>