- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Sat, 9 Mar 2002 12:12:14 +0000
- To: "Konstantin Komissarchik" <kosta@www.lt-rider.net>
- CC: xmlschema-dev@w3.org
Hi Konstantin, > Our question is how to deliver this "compound schema" that > references multiple namespaces, without requiring that the schema > documents be stored in multiple files, or retrieved independently by > URL, etc. In other words, we need some way to bundle these schemas > together, and possibly also some legal way to use the schema > location "hint" to indicate that the schemas are bundled together. I *think* that it is possible to bundle schemas for distinct namespaces together in the same document with the id attribute on xs:schema used to provide anchors for links between them. So with your example, I think that you should be able to do: <?xml version="1.0"?> <!DOCTYPE schemas [ <!ELEMENT xs:schema ANY> <!ATTLIST xs:schema id ID #REQUIRED> ]> <schemas xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:hr="http://www.nimble.com/HumanResources" xmlns:eng="http://www.nimble.com/Engineering" xmlns:rs="http://www.nimble.com/results" xmlns:re="http://www.nimble.com/resultenvelope"> <xs:schema id="resultenvelope" targetNamespace="http://www.nimble.com/resultenvelope"> <xs:import namespace="http://www.nimble.com/results" schemaLocation="#results" /> <xs:element name="envelope"> <xs:complexType> <xs:sequence> <xs:element ref="rs:record" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> <xs:schema id="results" targetNamespace="http://www.nimble.com/results"> <xs:import namespace="http://www.nimble.com/HumanResources" /> <xs:import namespace="http://www.nimble.com/Engineering" /> <xs:element name="record"> <xs:complexType> <xs:sequence> <xs:element ref="hr:employee" /> <xs:element ref="eng:project" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> </schemas> If this file were schemas.xml, you should then be able to validate against the resultenvelope schema with the URL schemas.xml#resultenvelope. However, just because this is theoretically possible doesn't mean that any schema validator will be able to use it - I don't know if any of the processors recognise fragment identifiers within URLs that are supposed to be pointing to XML Schema documents. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Saturday, 9 March 2002 07:12:16 UTC