users@jaxb.java.net

Re: 2 schema

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Fri, 11 Apr 2008 19:36:33 +0200

Hi.

> I have 2 schema. One imports the other, for example schema-b:
>
> <xs:schema
> xmlns:xa="http://www.degenaro.com/schema-a"
> xmlns:xb="http://www.degenaro.com/schema-b"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
> jxb:version="2.0"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> jxb:extensionBindingPrefixes="xjc"
> >
> <xs:import schemaLocation="a.xsd"
> namespace="http://www.degenaro.com/schema-a" />
>
> and employs it thus:
>
> <xs:complexType name="abc-type">
> <xs:choice>
> <xs:element name="abc-string" type="xs:string" />
> <xs:element name="abc-import" type="xa:a-thingy" />
> </xs:choice>
> </xs:complexType>
>
> Both schema are in the same directory. I run separate ant scripts to
> generate jaxb code to separate destinations directories I get classes
> generated for schema-a and schema-b both representing a-thingy in those
> separate directories. But the objective is to have just one class for
> a-thingy, and have it's representation embedded in b-thingy. Where can I
> see an example of how to do this?

See separate compilation or episodic compilation:

http://weblogs.java.net/blog/kohsuke/archive/2006/09/separate_compil.html

Bye.
/lexi