users@jaxb.java.net

Re: how to use catalogs with jaxb 2.0

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 01 Aug 2005 11:20:42 -0700

Johannes Echterhoff wrote:
> I downloaded JAXB RI 2.0 early access 2 (2005/06/22) and tried this at
> first. I tried to use the -catalog option for specifying where the
> compiler can find the imported xsd. The command i used is: "xjc -d
> result -catalog CustomCatalogTest.xml schemas". However this did not
> work. The Catalog (CustomCatalogTest.xml) is located in the same folder
> from where i made the command. Is the command wrong? How could the
> '-catalog <file>'-part of the command look like? Or are catalogs not
> supported with this version of JAXB?

Your command line parameters look correct to me.

There has been a few bugs around the resolver that are recently found.
So I suggest you try the latest weekly (the one for this week will be
posted soon.)

Also try,

   $ java -Dxml.catalog.verbosity=999 -jar jaxb-xjc.jar ...

to see some debug output from the catalog resolver. It should show you
how XJC is asking the resolver to resolve resources.


> After this did not work i tried to find an example that shows how to use
> the -catalog-option with xjc. This lead me to the
> catalog-resolver-example that is unfortunately not with the samples of
> JAXB RI 2.0 ea. So i downloaded JWSDP 1.6 and there i found it - that
> version of JAXB works with my simple example but not with the real
> important schemas. However, JAXB 2.0 seems so succeed where other
> xml-binding-tools surrendered - so back to JAXB 2.0.

I actually didn't know that catalog-resolver-example is no longer in 2.0
ea2. That sounds like another bug to me...

> To conclude:
> - How can xml-catalogs be used with JAXB 2.0? Are there examples of
> using catalogs directly with Java-classes like
> com.sun.tools.xjc.api.SchemaCompiler rather than having to use the
> command line?
> - Or is something wrong with my catalog, e.g. the location or format?
>
> Regards,
> Johannes Echterhoff
>
> P.S.:
> This is the catalog i use:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <rewriteSystem
> systemIdStartString="http://www.test.com/schema/pricesummary"
> rewritePrefix="file:///C:/Daten/Java/Eclipse_3_1_workspace/catalog-resolver"/>
> </catalog>
>
> And this is the output from the command line:
> C:\Daten\SPS_x2j_test>xjc -d result -catalog CustomCatalogTest.xml schemas
> parsing a schema...
> [ERROR] java.io.FileNotFoundException:
> http://www.test.com/schema/pricesummary/PriceSummary.xsd
> line 2 of file:/C:/Daten/SPS_x2j_test/schemas/EasyPO.xsd
>
> Failed to parse a schema.
>
> C:\Daten\SPS_x2j_test>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com