Problem with XML Catalog

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
matsek
Posts: 11
Joined: Tue Nov 01, 2011 12:24 pm

Problem with XML Catalog

Post by matsek » Tue Feb 05, 2013 5:56 pm

Hi,

I am having problem with using an XML catalog. Hope someone can help.

I am validating a set of XML files using a Schematron schema. The schema references some external XML files for the assert tests, and loads these using expressions like "document('subdir/data.xml')". I have then an XML Catalog file, which I have added to the list of catalog files in the Preferences (at both Global and Project scope), and which contains mappings like this <uri name="subdir/data.xml" uri="localpath-to-xml-file"/>.

No matter how much I play around with the settings, the Catalogs log panel shows:

Description: Resolved URI: file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/subdir/data.xml file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/subdir/data.xml

That is, the catalog mapping seems to have no effect!

I am on v14.1. Thanks for help!

Regards,
Mats

adrian
Posts: 2659
Joined: Tue May 17, 2005 4:01 pm

Re: Problem with XML Catalog

Post by adrian » Tue Feb 05, 2013 6:44 pm

Hi,

This is not going to work:

Code: Select all

<uri name="subdir/data.xml" uri="localpath-to-xml-file"/>
The problem is that @name has to be an absolute URI, and you're using a relative one. The reason this doesn't work is that the URI from document('subdir/data.xml') gets expanded to an absolute URI prior to being resolved by the XML catalog resolver. So the absolute URI ends up being: file:/C:/Program%20Files/Oxygen%20XML%20Editor%2014/subdir/data.xml

So, since you don't have an absolute URI, you should use uriSuffix instead:

Code: Select all

<uriSuffix uriSuffix="/subdir/data.xml" uri="localpath-to-xml-file"/>
Note that I've added a '/' before 'subdir' to make sure it won't match partial paths (e.g. thissubdir, thatsubdir).

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

matsek
Posts: 11
Joined: Tue Nov 01, 2011 12:24 pm

Re: Problem with XML Catalog

Post by matsek » Tue Feb 05, 2013 7:36 pm

Wonderful! Thanks Adrian.

Mats

Post Reply