users@jaxb.java.net

Re: Resolve the schema location from the classpath?

From: stug23 <pat.podenski_at_gmail.com>
Date: Mon, 4 Aug 2008 13:05:39 -0700 (PDT)

Lexi,

This is a nice addition to the Maven JAXB plugin! Good work!

I did notice one glitch when I downloaded the 0.6.1 episode sample -- the
parent pom version didn't match the version in the b module. Once I changed
the version the project produced the expected results.

This successful addition did lead me to one more conclusion. That is for the
author or future editor of the b.xsd XML Schema there will still be an error
reported when the a.xsd file is not referenceable via the value specified in
the b.xsd import statement for a.xsd. That's because the Eclipse XML Schema
editor won't be able to take advantage of the catalog for episodes.

I did notice that Eclipse does have an XML Catalog dialog which is part of
the Eclipse preferences system. This can be found at Preferences -- Web and
XML -- XML Catalog. However when I tried to create a user entry there for a
Maven artifact, this produced an error due to the '.' in
~/.m2/repository/... path.

Does anyone here know if there is a way to reference a Maven jar with the
Eclipse XML Catalog such that the Eclipse XML Schema Editor can resolve the
import statement for a.xsd when editing b.xsd?

Or is this question is better posed in the Eclipse forum?

Thanks for your excellent new addition to the Maven JAXB plugin!




Aleksei Valikov wrote:
>
> Hi folks,
>
> I have resolved both issues discussed in this thread.
>
> 1. I've added a new <catalogResolver/> option to the
> maven-jaxb2-plugin. You can use this option to configure a custom
> catalog resolver (must be a subclass of
> com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver). In
> your subclass you may override a method like
> getResolvedEntity (String publicId, String systemId) so implement your
> own entity resolution.
>
> 2. I've written the
> org.jvnet.jaxb2.maven2.resolver.tools.ClasspathCatalogResolver which
> is capable of handling classpath:com/acme/foo/myschema.xsd links.
>
> 3. Concerning the question by Malachi, it appeares that the catalog
> specification can handle this just fine. There is a reqriteSystem (or
> REWRITE_SYSTEM) element for instance allows to specify that everything
> at http://www.acme.com/foo should be read from classpath:com/acme/foo:
>
> REWRITE_SYSTEM "http://www.acme.com/foo" "classpath:com/acme/foo"
>
> 4. I've updated the catalog and episode tests/samples so you can take
> a look how it's done.
>
>
> For examples, take a look at the following two tests:
>
> https://maven-jaxb2-plugin.dev.java.net/svn/maven-jaxb2-plugin/trunk/tests/catalog/
> https://maven-jaxb2-plugin.dev.java.net/svn/maven-jaxb2-plugin/trunk/tests/episodes/
>
> All these changes are done in version 0.6.1, will be released this
> evening.
>
> Bye.
> /lexi
>
> Bye.
> /lexi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/Resolve-the-schema-location-from-the-classpath--tp7372851p18818676.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.