[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Composition by extension in namespaced schema

From: Michael Kay <mike@saxonica.com>
Date: Fri, 14 Mar 2008 19:22:23 -0000
To: "'Gavin Kistner'" <phrogz@mac.com>, <xmlschema-dev@w3.org>
Message-ID: <024001c88608$bb9d55d0$6401a8c0@turtle>
RE: Composition by extension in namespaced schema

> I need to use a targetNamespace (or is it an xmlns?) in my 
> schema so that I can validate other files without having to 
> add noNamespaceSchemaLocation to those files. Can someone 
> help me understand the core issue here, and (especially) how 
> to modify the file to accomplish the goal?
> 
> Thanks! Test case follows:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
> targetNamespace="http://www.foo.com/">
>   <xs:complexType name="mammal" />
>   <xs:element name="dog">
>     <xs:complexType><xs:complexContent>
>     	<xs:extension base="mammal" />
>     </xs:complexContent></xs:complexType>
>   </xs:element>
> </xs:schema>
> 

The type is in a namespace, so the reference to it needs to be prefixed:

> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
> targetNamespace="http://www.foo.com/"
  xmlns:tgt="http://www.foo.com/">
>   <xs:complexType name="mammal" />
>   <xs:element name="dog">
>     <xs:complexType><xs:complexContent>
>     	<xs:extension base="tgt:mammal" />
>     </xs:complexContent></xs:complexType>
>   </xs:element>
> </xs:schema>

Michael Kay
http://www.saxonica.com/
Received on Friday, 14 March 2008 19:23:04 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.