Page 1 of 1

Resolve xs:import with a catalog

Posted: Wed Oct 22, 2008 11:57 am
by jkh
Hi,

I have several schemas with import statements like

Code: Select all

<xs:import namespace="http://whatever"/>
that is without a schemaLocation-attribute. I tried to resolve these imports with an XML catalog file but the correct schemas never seem to be found. Enabling verbose-mode gives me

Code: Select all

Public: null System: null = null
while the modified import statement

Code: Select all

<xs:import namespace="http://whatever" schemaLocation="http://there"/>
results in the log-line

Code: Select all

Public: null System: http://there = null
.

Shouldn't the namespace be used as the "public" part of the query to the resolver? At least that's the way I've seen it in other applications that use a catalog file (e.g. XJC schema compiler from the JAXB RI) and I've been told, that Eclipse interprets catalog files like this, too.

Regards,
Janko

Re: Resolve xs:import with a catalog

Posted: Wed Oct 22, 2008 2:37 pm
by sorin_ristache
Hello,

The catalog resolver tries to resolve the URI references from XML Schema schemas only with system ID catalog entries (system, systemSuffix, etc). It should try with URI entries (uri, uriSuffix, etc) and we have this problem logged in our system for implementation in a future version but in the current version (9.3) you have to use system ID entries in the XML catalog for resolving URI references used in xs:import and xs:include elements.

There is also a request for resolving a schema URI by mapping the namespace so that a schema location is not needed in the import/include element but it was not implemented yet.


Regards,
Sorin

Re: Resolve xs:import with a catalog

Posted: Wed Oct 22, 2008 4:42 pm
by jkh
Ok, thanks for the information. I'll hope for a future version that fixes this problem :(

Re: Resolve xs:import with a catalog

Posted: Fri Jul 10, 2009 3:01 pm
by sorin_ristache
Hello,

The current version (10.3) includes a fix for this problem. If you install this version it should resolve the namespace of the schema with the XML catalog.


Regards,
Sorin

Re: Resolve xs:import with a catalog

Posted: Fri Oct 09, 2009 4:49 pm
by Glam
Sorry for digging this, but I have a similar problem. However, it is with 10.3

Here it is in short: we have a lot of XSDs, and catalogs that map them. For example"

Code: Select all

<public publicId="http://namespacesite.com/value/82" uri="address.xsd" />
Then for example:

Code: Select all


<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="something" targetNamespace="someting" xmlns:m="http://namespacesite.com/value/82">
<xsd:import namespace="http://namespacesite.com/value/82" />
<xsd:complexType name="myType">
<xsd:all>
<xsd:element name="referenced" type="m:someType"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
And Oxygen fails to resolve the m:someType. I tried adding the catalogs as absolute paths, as relative paths, used ${pdu} - nothing.

Then I tried a type from one of the schemas that are mapped in the default oxygen catalog:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="something" targetNamespace="something" xmlns:fo="http://www.w3.org/1999/XSL/Format/xsd/fo.xsd">
<xsd:import namespace="http://www.w3.org/1999/XSL/Format/xsd/fo.xsd" />
<xsd:complexType name="myType">
<xsd:all>
<xsd:element name="referenced" type="fo:row-group"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
Again - fails to reoslve it. So, basically - how to make it work? (I'm using the standalone Oxygen)
Note that our catalogs work perfectly in Eclipse (without Oxygen).

Regards.

Re: Resolve xs:import with a catalog

Posted: Fri Oct 09, 2009 5:03 pm
by sorin_ristache
Glam wrote:

Code: Select all

<public publicId="http://namespacesite.com/value/82" uri="address.xsd" />
...

Code: Select all

  <xsd:import namespace="http://namespacesite.com/value/82" />
You have to use a uri type entry in the XML catalog, for example:

Code: Select all

<uri name="http://namespacesite.com/value/82" uri="address.xsd"/>

Regards,
Sorin

Re: Resolve xs:import with a catalog

Posted: Thu Nov 12, 2009 6:56 pm
by spryspectre
Not to hijack the thread, but I have a similar issue with version 11. I have the project set to enable XInclude processing, and I've already added the project's catalog file to the project settings using ${pdu}/catalog.xml. The catalog file has the the following two rewrites:

Code: Select all

<rewriteURI uriStartString="file:///common/" rewritePrefix="../../../../../common/man/"/>
<rewriteSystem systemIdStartString="file:///common/" rewritePrefix="../../../../../common/man/"/>
The (docbook) xml file in question is as follows:

Code: Select all

<!DOCTYPE book [
<!ENTITY % common_ents SYSTEM "file:///common/entities.ent">
%common_ents;
]>
<!-- the above entity file is being resolved correctly -->
...
<!-- this fails to resolve correctly -->
<xi:include href="file:///common/info.xml"/>
Does anyone know why the <!DOCTYPE> resolves correctly, but the <xi:include> does not?

Re: Resolve xs:import with a catalog

Posted: Fri Nov 13, 2009 1:11 pm
by sorin_ristache
Hello,

If info.xml is in the same folder as entities.ent it should work. I tested your rewriteSystem in an XML catalog that I added from Options -> Preferences -> XML -> XML Catalog. On what platform do you run Oxygen? What errors are reported in the Catalogs view if you set Verbosity to Unresolved entities in Preferences -> XML -> XML Catalog?


Regards,
Sorin

Re: Resolve xs:import with a catalog

Posted: Fri Nov 13, 2009 7:13 pm
by spryspectre
The messages I got from the Catalogs view said that "file:///local/" was resolving correctly, however the error message from Jing claimed it could not parse "file:/local/info.xml", which led me to think that Jing wasn't getting the rewritten value... However, I discovered a minor issue in the info.xml file (I apparently deleted a "/" on a closing tag by accident), and this fixed the problem.

The message from Jing was slightly misleading. Is there a way to put the rewritten value into the error messages?

Re: Resolve xs:import with a catalog

Posted: Mon Nov 16, 2009 3:42 pm
by sorin_ristache
Hello,

Jing reports the file path that it cannot find. It does not know what is the rewritten value that was found in the catalog because that is handled by other component. If the rewritten value cannot be found you see it in the Catalogs view if you enable the verbosity option in Preferences -> XML -> XML Catalog.


Regards,
Sorin