Hello,
I've something strange, and don't know if I do not understand OASIS
catalog specification, or if there is a bug in Apache Resolver...
I have this catalog :
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<group xml:base="cp:/catalog.xml">
<rewriteURI uriStartString="foo:" rewritePrefix="cp:"/>
<rewriteSystem systemIdStartString="foo:" rewritePrefix="cp:"/>
</group>
<group xml:base="file:/home/fake/catalog.xml" [1]>
<rewriteURI uriStartString="bar:" rewritePrefix="cp:"/>
<rewriteSystem systemIdStartString="bar:" rewritePrefix="cp:"/>
</group>
</catalog>
Dependending on I have or not support for cp: protocol (first group
xml:base), the first xml:base (cp:/catalog.xml) is rewritten fo
file:cp:/catalog.xml. It is normal ? I can imagine that new
URI(xx).isAbsolute() is used to know if it should be absolutized (?).
That's strange, but, Ok, I can accept this...
Then, if cp: support is enabled, if I try to resolve
bar:/schemaBar/bar.rnc, it is resolved as cp:/schemaBar/bar.rnc, but
if I try to resolve foe:/schemaFoe/foe.rnc, it is resolved as null.
My question is : with rewriteSystem / rewriteURI, does the xml:base
may change the resolution ? In specification, xml:base is not
mentionned in
https://www.oasis-open.org/committees/entity/spec-2001-08-06.html#s.rewrite,
but it is said " If the value of the rewritePrefix attribute is
relative, it must be made absolute with respect to the base URI
currently in effect." in
https://www.oasis-open.org/committees/entity/spec-2001-08-06.html#s.rewritesystem
My thought was that xml:base was used only to absolutized relatives
URI, and not absolute ones. Then, with Apache resolver, if I set debug
output ON, I get this while loading catalog :
Cannot find CatalogManager.properties
Parse catalog: ./xcatalog
Loading catalog: ./xcatalog
Default BASE:
file:////home/ext-cmarchand/devel/apache/xml-commons/xcatalog
Catalog does not exist:
file:////home/ext-cmarchand/devel/apache/xml-commons/xcatalog
Parse catalog: ../../github/jing-trang/cmarchand_test/catalog-bug.xml
Loading catalog:
../../github/jing-trang/cmarchand_test/catalog-bug.xml
Default BASE:
file:////home/ext-cmarchand/devel/github/jing-trang/cmarchand_test/catalog-bug.xml
xml:base: cp:/catalog.xml
BASE CUR:
file:////home/ext-cmarchand/devel/github/jing-trang/cmarchand_test/catalog-bug.xml
BASE STR: cp:/catalog.xml
BASE NEW: cp:/catalog.xml
rewriteURI: foo:
cp:
REWRITE_URI: foo:
cp:/catalog.xml
rewriteSystem: foo:
cp:
REWRITE_SYSTEM: foo:
cp:/catalog.xml
(reset) xml:base:
file:////home/ext-cmarchand/devel/github/jing-trang/cmarchand_test/catalog-bug.xml
BASE CUR: cp:/catalog.xml
BASE STR:
file:////home/ext-cmarchand/devel/github/jing-trang/cmarchand_test/catalog-bug.xml
BASE NEW:
file:////home/ext-cmarchand/devel/github/jing-trang/cmarchand_test/catalog-bug.xml
xml:base: file:/home/fake/catalog.xml
BASE CUR:
file:////home/ext-cmarchand/devel/github/jing-trang/cmarchand_test/catalog-bug.xml
BASE STR: file:/home/fake/catalog.xml
BASE NEW: file:/home/fake/catalog.xml
rewriteURI: bar:
cp:
REWRITE_URI: bar:
cp:
rewriteSystem: bar:
cp:
REWRITE_SYSTEM: bar:
cp:
(reset) xml:base:
file:////home/ext-cmarchand/devel/github/jing-trang/cmarchand_test/catalog-bug.xml
BASE CUR: file:/home/fake/catalog.xml
BASE STR:
file:////home/ext-cmarchand/devel/github/jing-trang/cmarchand_test/catalog-bug.xml
BASE NEW:
file:////home/ext-cmarchand/devel/github/jing-trang/cmarchand_test/catalog-bug.xml
We can see the REWRITE_SYSTEM are not processed the same with
different xml:base.
I will enjoy any help to locate the problem (my code, my catalog, or
Apache Resolver)...
Thanks in advance,
Christophe
Links:
------
[1] file:/home/fake/catalog.xml