users@jaxb.java.net

Re: Resolve the schema location from the classpath?

From: ostracke <olaf.stracke_at_pangora.com>
Date: Thu, 31 Jul 2008 00:32:18 -0700 (PDT)

Hello Kenny,

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.

Best
Olaf


Kenny MacLeod wrote:
>
> Are you trying to create a Schema object? If so, SchemaFactory just
> needs the InputStream of the schema file, and you can get this from
> Class.getResourceAsStream("/path/to/schema.xsd")
>
> I use Spring's Resource abstraction for this sort of thing. Very nice.
>
> ostracke wrote:
>> Hello,
>>
>> I´m confronted with the same problem. Yes, of course I
>> could set the URL in my catalog to something like
>> "jar:file:...!/path/to/schema.xsd".
>> But than I have to know the exact name and location of
>> the jar, which is not very nice especially working in a maven
>> project.
>> I would like to set it to something like "classpath:/path/to/schema.xsd".
>> Or alternatively I would like to set an entityResolver instead
>> of a catalog file, so I could care for resolving the dependent
>> schemas on my own.
>>
>> Does anybody know a solution to this problem?
>>
>> Thanks in advance,
>> Olaf
>>
>>
>>
>> Kohsuke Kawaguchi wrote:
>>> James Mao wrote:
>>>> entity resolver you mentioned may solve my problem, but i don't know
>>>> how
>>>> to add the entity resolver into the xjc maven plugin, do you know how
>>>> or
>>>> where's the doc?
>>> I believe the plugin should have associated documents. If not, please
>>> contact their authors.
>>>
>>>
>>>> I think the catalog has the same problem, it'll not look into the
>>>> classpath to resolve the schemaLocation, right?
>>> The issue is really not so much as to whether something can "look into
>>> the classpath". All the resources in a jar has an URL. So all you need
>>> to do is to make sure XJC gets that URL.
>>>
>>> --
>>> Kohsuke Kawaguchi
>>> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Resolve-the-schema-location-from-the-classpath--tp7372851p18735106.html
>> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>
> ---------------------------------------------------------------------
> 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--tp7372851p18749286.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.