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

RE: "Proper" use of namespace - as schema or as authority ?

  • From: "David Lee" <dlee@calldei.com>
  • To: "'Michael Sokolov'" <sokolov@ifactory.com>
  • Date: Mon, 27 Dec 2010 08:32:23 -0500

RE:  "Proper" use of namespace - as schema or as authority ?

Thanks, interesting last point.

I've always known that single Instance documents could be assigned to different schemas, and see the rationale for that.

But I had not considered the reverse, although of course I know its possible, I've just never thought about.

Making a single schema for a set of related instance documents. 

My first off-the-cuff reaction is that it then makes it more confusing if you're looking at a schema to determine "What can be in document X" …

but then I realized that can be implied by having all top level elements (possible roots) be associated with each instance type …

So there's really no difference between one schema document and several if viewed that way,  PLUS it overcomes the last barrier I had in my mind,

that each schema should have a single namespace which it describes.    This solves both problems !

 

This is particularly appropriate to this toolset because in several cases there really is no "document" associated with a set of elements,

for example the case where elements are used in schema annotations … they are really logically 'free standing elements'  buried within the schema document itself,

which further justifies the case where a single schema could be used to represent all the related types, instead of  breaking it out by 'document type'.

 

Thank you.

 

 

----------------------------------------

David A. Lee

dlee@calldei.com

http://www.xmlsh.org

 

From: Michael Sokolov [mailto:sokolov@i...]
Sent: Monday, December 27, 2010 8:25 AM
To: David Lee
Cc: xml-dev@l...
Subject: Re: "Proper" use of namespace - as schema or as authority ?

 

My view on this is pragmatic, and based on the idea that namespaces exist to make it possible to mix vocabularies with name clashes.  Therefore if a single naming authority can enforce the uniqueness names throughout some schema or set of schemas, only one namespace is required for that.  Using additional namespaces tends to add confusion and only has value insofar as it  helps to avoid element-name ambiguity.

I think the other goal you have - identifying documents as belonging to a schema - can be done by the root element's QName, or, if more specificity is required, by an additional mechanism you define (such as "doc-type" or "version" attribute on the root element).

Also consider that the division of your schema information into multiple schemas is somewhat arbitrary.  Couldn't you just as well combine them into a single schema that covers multiple document types?

-Mike

On 12/27/2010 8:05 AM, David Lee wrote:

I'd love some opinions/advise on what is considered the "Proper" (for lack of a better term like "Best Practice" ) on how to use namespaces.

I'm developing a tool which has several XML document types which it is creating and consuming.

I started out in no-namespace but I'm evolving towards using a namespace for them.

My rationale is

 

1) This will eventually be published so may be used by a variety of people/orgs/tools so putting it in a namespace seems useful.

2) SOME (but not all) of the types are embedded in XSD and XSLT so I'd like to use a namespace to avoid ambiguity.

 

Since I think #2 nearly requires a namespace to be safe, I'm thinking I should put ALL the xml this tool uses and consumes in a namespace for consistency more than anything even if its currently internal data only.   Plus that data might eventually come from other tools so I'm trying to be forward thinking, but at the same time not add unnecessary complexity.

( not sure that’s *possible* with namespaces but it’s a 'stretch goal')

 

So my question is …

A) Should I use a different namespace URI for every document type ?  Even if the elements it shares are completely orthogonal ?

Or

B) Should I use a single namespace as an 'authority' concept, saying "All elements within this namespace belong to this toolset"

(I don’t have a better word for "authority").

 

My thinking so far is  

A) By using a different namespace for each document type I am associating a 1:1 schema -> namespace.   This provides the highest clarity (specificity).

Specificity and clarity are good.

 

B) By using a single namespace it is the minimum needed to keep 'my stuff' separated from 'your stuff' and is the most simple approach that still uses namespaces.

Simplicity is good.

 

 

Any ideas on how to choose which is "better" ?   I'm pretty sure there is no 'right' answer (or is there ?)

 

Thanks for any advice.

 

 

----------------------------------------

David A. Lee

dlee@calldei.com

http://www.xmlsh.org

 

 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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-2013 All Rights Reserved.