- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 17 Jan 2001 15:08:02 +0000
- To: Michael Anderson <michael@research.canon.com.au>
- Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Michael Anderson <michael@research.canon.com.au> writes: > I'm curious to know the difference between the two following schemas > <schema xmlns="http://www.w3.org/2000/XMLSchema" > xmlns:cisra = "http://cisra.au"> > <import namespace="http://cisra.au" > schemaLocation="http://www.cisra.com.au/mySchema.xsd"/> > <element name="food" type="cisra:Weetbix"/> > </schema> > > AND > > <schema xmlns="http://www.w3.org/2000/XMLSchema" > xmlns:cisra = "http://cisra.au"> > xsi:schemaLocation="http://cisra.au > > http://www.cisra.com.au/mySchema.xsd"/> > <element name="food" type="cisra:Weetbix"/> > </schema> [Note your NS URI for XML Schema is in error, should be http://www.w3.org/2000/10/XMLSchema] > Is it that you _must_ import the namespace using <import> before you can > use components from it in your schema? Yes. And the imported schema must have "http://cisra.au" as its targetNamespace. > Also, while on the subject of import.... > There is also a statement in the specs [Structures 6.2.3] - "When a > schemaLocation is present, it must contain a single URI reference which > the schema author warrants will resolve to a schema document containing > the component(s) in the imported namespace referred to elsewhere in the > containing schema document." This sounds to me like a constraint > (although it doesn't appear in the src) that components referred to > elsewhere in the containing document _must_ come from this schema > document. I'm pretty sure this is not the case as schemaLocation is, > elsewhere, _always_ used as a _hint_only_. In which case, is this > statement saying that the schema document, if resolved, _must_ have at > least one component that is in a schema information item that has a > targetNamespace that matches the import statement? No, and I'll try to change the prose to be less misleading in this regard. ht -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh W3C Fellow 1999--2001, part-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/
Received on Wednesday, 17 January 2001 10:08:06 UTC