users@jaxb.java.net

Re: Resolve the schema location from the classpath?

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Thu, 31 Jul 2008 10:07:49 +0200

Hi.

> thank you. But the context is a little bit different here.
> I´m using a xjc maven2 plugin, which converts the schemas
> to java classes.
> So I have to tell this plugin to resolve the classpath to find
> the referenced schema.
> The way to use a xml-catalog works fine, but if I use this
> way, there´s a file-path-dependency between two projects.
> So I would like to just configure the classpath to the referenced
> schema.

I think what's necessary to resolve such tasks is to introduce a
configurable URI resolver which would be used by XJC when resolving
schema URIs. Then you could do the following:

* Use the catalog file to map http://www.acme.foo/mySchema.xsd onto
classpath:/com/acme/foo/MySchema.xsd
* Configure URI resolver to resolve
classpath:/com/acme/foo/MySchema.xsd against the classpath into the
real URI.

I can extend the maven-jaxb2-plugin to support this. However I'd be
grateful if one of those iterested could put up a test scenario
together.

Bye.
/lexi