users@jaxb.java.net

Re: Can I apply bindings to included schemas?

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Wed, 27 Jun 2012 13:57:17 +0200

The inline binding element <globalBindings> is documented as acting
recursively into included and imported schemas.

If you don't want to modify your top level XML schema, write another
one <include>ing that one.

Untried.
-W

On 27/06/2012, peter.follo+javadev_at_foi.se <peter.follo+javadev_at_foi.se> wrote:
> If one wants to annotate every 'complexType' in the generated code with
> say a 'SuppressWarnings' annotation one could use a binding file
> looking something like this:
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <jaxb:bindings
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:annox="http://annox.dev.java.net"
> xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb
> http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
> jaxb:extensionBindingPrefixes="xjc annox"
> version="2.1">
>
> <jaxb:bindings
> schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gmlBase.xsd"
> node="/xs:schema" >
> <jaxb:bindings node="xs:complexType" multiple="true"
> required="false">
> <annox:annotate>
> <annox:annotate annox:class="java.lang.SuppressWarnings"
> value="unused"/>
> </annox:annotate>
> </jaxb:bindings>
> </jaxb:bindings>
>
> </jaxb:bindings>
>
> And it works all fine :-)
>
> However, if the schema imports other schemas, such as
> http://schemas.opengis.net/citygml/profiles/base/1.0/CityGML.xsd do,
> this binding rule won't traverse recursively to the imported schemas.
> Is there a way to make this rule traverse imported schemas? Can I use
> some sort of global binding instead? Can I use some kind of wildcard as
> a value to schemaLocation? Ideas anyone?
>