Re: target namespace and namespaces

Michael Kay wrote:

> I think there's a real contradiction in the design philosophy here.
> 
> On the one hand, XML Schema recognizes that different people may want to
> apply different validation criteria to the same document at different stages
> of its lifecycle. The sender, for example, may apply stricter rules than the
> recipient. So there can be more than one schema that's applicable to a given
> document.
> 
> On the other hand, XML Schema suggests that knowing the target namespace is
> enough information for a schema processor to go and find a schema, with the
> schema location being just a hint. If there is more than one schema for a
> namespace, then there is no way of telling the processor reliably which one
> you want to use.

As a matter of general practice I agree--for a given XML namespace there 
should be exactly one XSD schema in any given processing environment.

However, if you had multiple XSD schemas associated with the same name 
space in a given environment (for example, in an XML-aware repository 
that maintains dependency relationships between documents and schemas) 
it just means that you'd have to provide some additional mechanism for 
knowing what schema to apply in a given situation. This would, of 
course, be business process specific but there are any number of obvious 
ways to do it, such as through distinguishing metadata within the schema 
document or through repository-managed metadata. For example, if I had 
the requirement for both "minimal" and "rigorous" versions of the same 
schema I could classify the XSD schema documents appropriately at the 
repository level and then use that classification to retrieve the 
appropriate schema as needed. Given an XML document to be validated, the 
processor would ask the repository for the schemas associated with each 
namespace used in the document. If it got back a list of more than one 
for any namespace it would be up to the application to select the one it 
wants, which it could do by examining the repository-held metadata for 
each schema.

This presumes a data management environment that understands the 
potential and actual relationships between XML documents and XSD schemas 
and provides facilities for creating and using those relationships. I've 
done some experimentation with that in my toy XML-aware content 
management system XIRUSS-T (on SourceForge), which provides a basic 
"governed-by" relationship that can be established between XML documents 
and XSD schemas (or any other sort of schema object). I've implemented 
automatic association based on targetNamespace and schemaLocation 
attributes but the facility is generic so the associations could be made 
some other way and, while processors might expect to only get a single 
schema per namespace, the underlying association mechanism has no 
problem representing multiple schemas associated with the same namespace.

Cheers,

Eliot
-- 
W. Eliot Kimber
Professional Services
Innodata Isogen
9390 Research Blvd, #410
Austin, TX 78759
(512) 372-8122

eliot@innodata-isogen.com
www.innodata-isogen.com

Received on Friday, 3 December 2004 17:02:31 UTC