[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Understanding the scope of XML catalog
Hi Ken, The namespace URI is just an identifier and does not associate a schema with the instance. You probably need to provide an xsi:schemaLocation URI to tell the parser/reader where the schema is, and a catalog-resolving validating parser should in fact respect a catalog entry in which you provide the location of the associated schema on your hard disk. I'm not sure what the catalog spec authors had in mind when they wrote that the uri element (and related elements such as rewriteURI) can be used to map namespace names. Maybe they wanted me to allow to provide an alias for a namespace URI, like this: <uri name="foobar" uri="http://www.tei-c.org/ns/1.0"/> But this would amount to using the catalog entry the other way around, compared to what you tried to achieve. oXygen, for example, both supports catalogs and can use namespace URIs to associate schemas with document instances. So I tried to use this foobar->TEI mapping above to get oXygen to use the TEI schema as per its default document association rules when I start a document with <TEI xmlns="foobar"> instead of <TEI xmlns="http://www.tei-c.org/ns/1.0">. Yet apparently oXygen does not respect the catalog mapping above to resolve 'foobar' to the actual namespace URI and then apply its document type association mechanism. Apparently oXygen is selective with respect to which kinds of URIs it maps. [continued below] On 02.03.2019 03:06, G. Ken Holman wrote: Fellow XML-Dev'ers,As stated above, I think tools can be selective in which types of resources they use catalog resolvers for. For example, Saxon uses it only for resolving references to other XML resources: https://www.saxonica.com/documentation/#!sourcedocs/xml-catalogs “The catalog is NOT currently used for non-XML resources, including query modules, unparsed text files, collations, and collections.” So of the list of possibly resolvable items that you quoted from the catalog spec, Saxon will only use the catalog to resolve XSLT imports/includes, schema documents, XML resources requested by doc(), but not, for example, by unparsed-text() or file:read-binary() (https://www.saxonica.com/documentation/#!functions/expath-file/read-binary). So even if I configure the catalog to map <uri name="test.png" uri="../img/actual-location.png"/> and use <xsl:sequence select="file:read-binary('test.png')"/> it will throw an error "file:not-found: No file exists at test.png" because it is not configured to use the XML catalog for "graphics". So I guess that just like binary locations, common XML catalog resolvers or rather, the tools that employ these resolvers, simply omit namespace URI mappings, binary file locations, etc. from the resolvable resources, and restrict themselves to XML resources. Returning to what I said above: But even if the catalog spec were prescriptive and required resolvers to consider your "namespace to local resource" mapping, a catalog-resolving parser would still not be able to find the schema since namespace URIs don't resolve to schema locations (except when the namespace URI and the schema location happens to be identical). Such a namespace-resolving parser would rather complain, if you managed to point it to the schema by other means (xsi:schemaLocation), that the catalog-resolved namespace URI of the top-level element, 'maindoc/UBL-Invoice-2.2.xsd', does not correspond to the namespace URI that is expected by the schema, which still is 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'. Gerrit
-- Gerrit Imsieke Geschäftsführer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@le-tex.de, http://www.le-tex.de Registergericht / Commercial Register: Amtsgericht Leipzig Registernummer / Registration Number: HRB 24930 Geschäftsführer / Managing Directors: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|