Hi Michael,

Thanks for the info, I checked a bit xml-commons resolver component, that helped. The resolver seems to use mostly absolute URLs anyway. It seems the easiest solution is the one working... Passing to the setCatalogList a simple URL in external form worked just fine.
---
URL xmlCatalogUrl = .........getResource("/xmlCatalog.xml"); //this XML is the same I gave earlier - xsd schemas are next to the xmlCatalog.xml
String[] catalogs = {xmlCatalogUrl.toExternalForm()};
setCatalogList(catalogs);
---

Thanks,
Yoann


On 3/30/12 8:15 PM, Michael Glavassevich wrote:
Hi Yoann,

The XMLCatalogResolver just passes the catalog file names down to the XML Commons Resolver's Catalog.parseCatalog() method [1]. So XMLCatalogResolver accepts whatever Catalog.parseCatalog() accepts. I know that doesn't really answer your question, though hope you might get closer if you looked at little deeper there.

Thanks.

[1] http://xml.apache.org/commons/components/apidocs/resolver/org/apache/xml/resolver/Catalog.html#parseCatalog%28java.lang.String%29

Michael Glavassevich
XML Technologies and WAS Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

Yoann Moranville <yoann.moranvi...@gmail.com> wrote on 29/03/2012 09:32:19 AM:

> From: Yoann Moranville <yoann.moranvi...@gmail.com>
> To: j-users@xerces.apache.org,
> Date: 29/03/2012 09:38 AM
> Subject: XMLCatalogResolver and catalog.xml within jar file
>
> Hi all,
>
> I have a problem using XML catalogs.
> Basically, the project is like this:
> - main jar file
> -- including a "logic" jar file
> --- including a few schemas + a catalog.xml file
>
> In the main program, I call an method that should validate an XML file,
> but since it could happen offline, I wanted to use XML catalogs in order
> to have the schema locally. For some reasons, the schemas need to stay
> where they are (in the second jar file).
> I use the XSD directly into a Schema object
> (schemaFactory.newSchema(....)), but this schema imports another XSD
> (schema.xsd) which points somewhere online.
>
> It does not quite work, I can not actually read the catalog.xml file
> from the XMLCatalogResolver.
>
> Catalog.xml:
> <!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog
> V1.0//EN"
> "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";>
> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
> prefer="public">
> <uri name="http://www.example.org/schema"; uri="schema.xsd"/>
> </catalog>
>
> The XMLCatalogResolver accepts an array of String for the setCatalogList
> method. What kind of String should I pass to that method?
>
> Thanks for the help,
> Yoann
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to