[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 16:40:30 +0100
To: "'Andrew Welch'" <andrew.j.welch@gmail.com>, <noah_mendelsohn@us.ibm.com>
Cc: <xmlschema-dev@w3.org>
Message-ID: <00fb01c785bd$b9d33bd0$6401a8c0@turtle>
RE: multiple namespaces

> The keys points here are:
> 
> - there are two namespaces
> - each namespace contains elements in the other namespace
> 
> In order to model this I created two schema documents ns1.xsd 
> and ns2.xsd which import each other:

Correct.
> 
> I'd like any comments on this approach - its seems strange to 
> have circular imports

Think Java "import" rather than XSLT "import". It's not at all strange in
Java for two modules to import each other. In XSD, import means "this module
references components defined in that module".

, and when referencing the simpleType 
> and the group prefixes are needed - unless as Mike says I add 
> a default namespace, which I think would make the top of the 
> schema document:
> 
> targetNamespace="firstNamespace"
> xmlns:ns1="firstNamespace"
> xmlns="firstNamespace"
> 
> ...which is fine but a little non-intuitive at the moment - 
> is there a preferred approach?

One sees different coding styles, but it's certainly not unusual to see
schema documents that are just like this: the targetNamespace is bound both
to an explicit prefix and to the default namespace. Personally I tend to use
the prefix, it helps to remind the reader what's going on and makes it
easier to cut-and-paste across schema documents.

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