users@jaxb.java.net

Re: changing package names in a Plugin

From: Andreas Pakulat <pakulat_at_rostock.zgdv.de>
Date: Wed, 05 Apr 2006 16:57:15 +0200

Kohsuke Kawaguchi schrieb:
> Andreas Pakulat wrote:
>> I'm trying to parse a whole lot of schema files. I have about 2-5
>> "entry" schema files, which I will give to jaxb. Everyone might
>> reference other schema files via xs:include or xs:import and those might
>> have different targetNamespaces. If I'm not totally mistaken I have
>> about 4 or 5 different namespaces. The problem here is I'd have to
>> figure out which "other" schema file is first imported from an entry
>> schema file for a particular namespace.
>
> No, you don't have to. As long as <jaxb:schemaBindings> is attached to
> any schema that has the desired target namespace, that would work.
> I often just write an empty schema with the right target namespace +
> <jaxb:schemaBindings> to apply a binding.

That worked out pretty fine, I now have a nearly empty schema with just
the jaxb:schemaBindings annotation (it only includes a real schema) and
a main schema which imports all these special schema files.

So thanks for that idea.

> > I'd also have to have different
>> binding files for each entry-schema file as each might use another
>> schema file as first one for a particular namespace.
>
> This is also not true, as you can have all your bindings (that apply to
> different files) in one binding file, like this:

I got several error messages, but then I always had a separate <binding
xmlns="..."> element for each file...

>> Thus I thought overriding the toPackageName(String s) function of a
>> NameConverter would help here, however it seems that this method is
>> never called??
>
> Ah, yeah. As the javadoc of the toPackageName method say, this isn't
> really designed to accept a namespace URI.
>
> I'll change it.

The javadoc, or the method to accept namespace URI?

Andreas