users@jaxb.java.net

how to use catalogs with jaxb 2.0

From: Johannes Echterhoff <Johannes.Echterhoff_at_gmx.de>
Date: Mon, 01 Aug 2005 17:01:43 +0200

Hello.

I try to compile a schema which imports another schema. Both schemas are
located in different folders on my computer but the schemas are using
URLs as schema-locations so that normally the imported schema has to be
downloaded for compilation. This is only for testing of whether JAXB can
compile a much bigger set of schemas which are importing many other schemas.

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?

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.

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>