users@jaxb.java.net

Re: JWSDP-1.4 - XJC Ant Task

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 13 Mar 2007 09:47:53 -0700

Hilco Wijbenga wrote:
> Hi all,
>
> I've been using the command line interface in my Ant script to run XJC
> but now I'd like to start using the XJC Ant task. I'm afraid I've run
> into a little problem. I didn't find anything in the archive about
> this nor did ant -d help.
>
> I used to determine whether to supply the package name by checking the
> presence of any *.xjb files. If those were present I would not set the
> package name, otherwise I'd set the package name (-p com.example).
>
> I'm doing the same with the XJC Ant task but that doesn't seem to
> work. If I set the package name (package="com.example") then that
> works as expected. However, if I don't set the package name then the
> <jaxb:package name="com.example"/> in my *.xjb file appears to be
> completely ignored (I get an empty package name).
>
> What am I doing wrong?

Maybe you are doing <xjc package=""> ?

Then XJC assumes that you specified an emtpy value. In the following ant
build script fragment you cited, I don't see any such logic that you are
explaining above.

Are you saing that even the following script doesn't work?

> Cheers,
> Hilco
>
> <xjc target="${dir}" extension="true">
> <binding dir="${schema.dir}">
> <include name="*.xjb"/>
> </binding>
> <schema dir="${schema.dir}">
> <include name="*.xsd"/>
> </schema>
> </xjc>
>
> regions.xjb:
> <jaxb:bindings
> version="1.0"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>
> <jaxb:bindings schemaLocation="regions.xsd" node="//xs:schema">
> <jaxb:schemaBindings>
> <jaxb:package name="com.example"/>
> </jaxb:schemaBindings>
> </jaxb:bindings>
> </jaxb:bindings>
>
> regions.xsd:
> <xs:schema
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified"
>>
> <xs:element name="regions">
> <xs:complexType>
> <xs:sequence>
> <xs:element maxOccurs="unbounded" ref="region"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="region">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="label"/>
> </xs:sequence>
> <xs:attribute name="id" use="required" type="xs:NCName"/>
> </xs:complexType>
> </xs:element>
> <xs:element name="label" type="xs:string"/>
> </xs:schema>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com