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

RE: multiple namespaces

From: Michael Kay <mike@saxonica.com>
Date: Mon, 23 Apr 2007 15:21:12 +0100
To: "'Andrew Welch'" <andrew.j.welch@gmail.com>, <xmlschema-dev@w3.org>
Message-ID: <00d001c785b2$a564ad60$6401a8c0@turtle>
RE: multiple namespaces

> With this XML:
> 
>   <ns1:foo>some text</ns1:foo>
>   <ns2:bar>some text</ns2:bar>
> 
> Am I right in thinking I need two schemas - one for each namespace?

No, you need two *schema documents* each defining part of a single *schema*.

> Also, if I define a simple type of non-empty-string:
> 
>     <xs:simpleType name="non-empty-string">		
> 		<xs:restriction base="xs:string">		
> 			<xs:minLength value="1"/>		
> 		</xs:restriction>		
>     </xs:simpleType>	 	
> 
> ...when I refer to that type it seems I have to use the 
> prefix defined in the schema, for example to use the simple 
> type above I need:
> 
> <xs:element name="foo" type="ns1:non-empty-string"/>

No, you can omit the prefix, and the default namespace will be used (as
declared using xmlns="...". This is not necessarily the same as the target
namespace of the schema document).

>Am I missing something here?

Yes, I think so!

Michael Kay
http://www.saxonica.com/
Received on Monday, 23 April 2007 14:21:25 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.