users@jaxb.java.net

jaxb 2.0 multiple schemas

From: Scott Allan <sallan1000_at_aol.com>
Date: Wed, 17 Aug 2005 23:06:39 -0500

I hope this is not too confusing to follow...
 
I have a main schema that includes many different schema files.
Currently all the classes get written to the same package using
jaxb:schemaBindings and jaxb:package in the main schema. I want to be
able to split the generated classes into different packages such as an
ejb package and second package that would be able to use the classes in
the ejb package as complex types. How can I do this?
 
I came across this documentation (shown below) but I don't know if it
solves my problem or how I would implement it. Do I have to rename my
schemas to .rng and change <xs:schema> to <grammar>? Does everything
else stay the same? Does the xs namespace go away for these schemas? Can
I still use the plugins? Can you mix the xs:schemas and relaxng
schemas? A working example would be great.
 
The following example shows how to divide the generated code into two
packages by using the RELAX NG <div> tag:

<grammar xmlns="http://relaxng.org/ns/structure/1.0"

  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"

  jaxb:version="1.0">

  

  <div>

    <jaxb:schemaBindings>

      <jaxb:package name="com.acme.foo"/>

    </jaxb:schemaBindings>

    

    ... RELAX NG declarations ...

  </div>

  

  

  <div>

    <jaxb:schemaBindings>

      <jaxb:package name="com.acme.bar"/>

    </jaxb:schemaBindings>

    

    ... RELAX NG declarations ...

  </div>

  

</grammar>



If you have two schemas, foo.rng and bar.rng, one of which includes the
other, you can put them into two separate packages just by writing a
<schemaBindings> element for each schema file.


  _____

<< ella for Spam Control >> has removed 25482 Spam messages and set
aside 2 Newsletters for me
You can use it too - and it's FREE! www.ellaforspam.com