- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 29 Oct 2001 16:59:54 +0000
- To: "Schwarzhoff, Kelly" <kelly.schwarzhoff@commerceone.com>
- Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
"Schwarzhoff, Kelly" <kelly.schwarzhoff@commerceone.com> writes: > If I have a schema--call it schema A--with no namespace, and it is imported > by another schema--call it schema B--which does have a namespace (I do this > by using schemaLocation attribute, not namespace attribute), then how does > schema B refer to types in schema A. The reason I ask is because it appears > to be impossible, as there is no namespace so one would have to refer to it > of a QName where there is no prefix. In these cases though, if no namespace > is referenced, then when in schema B non-prefixed type references are > assumed to refer to types in current schema (B). It all works just fine, you just have to be careful with your namespace prefixes. See below. A.xsd: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema.xsd"> <xs:element name="foo"/> </xs:schema> B.xsd: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema.xsd" xmlns:me="urn:example" targetNamespace="urn:example"> <xs:import schemaLocation="A.xsd"/> <xs:complexType name="baz"> <xs:sequence> <xs:element ref="foo"/> </xs:sequence> </xs:complexType> <xs:element name="baz" type="me:baz"/> </xs:schema> Note in particular that the reference to foo is unqualified, because unprefixed in the absence of a default namespace declaration. 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 Monday, 29 October 2001 11:59:06 UTC