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

Namespaces Best Practice

  • From: Jonathan Borden <jborden@m...>
  • To: xml-dev@l...
  • Date: Sun, 26 Aug 2001 14:55:38 -0400

xml namespace best practice
Wow! I return from vacation to find such discussions of Namespaces x
Schemas. It has been quite difficult for me to follow/reconstruct the thread
of these arguments.

Back to basics.

It is a plain fact that the vast majority of major XML parsers as well as
significant XML related specifications such as XSLT, XHTML, XLink, XSD,
RELAXNG, Schematron etc. are XML Namespace aware. Love em or hate em XML
Namespaces are here to stay and we are best to define namespace best
practices.

1) An XML Namespaces best practice for document/application design is to
define all namespace prefix bindings at the document (root) element context.

2) Use of XML Namespaces is optional in XML document and application
design - however - it is a best practice to either use or not use XML
namespaces in a single document format/application. That is, if XML
Namespaces are to be used, it is a best practice to qualify all elements.

1) and 2) are related. Taken together, a document composed of elements
qualified by multiple namespaces should have a single _unprefixed_ namespace
and multiple prefixed namespaces. By defining the namespace - prefix
bindings at the document (root) element, it is easy for both people and
applications to understand the namespace structure of a document.
Unqualified elements confuse the picture because its not immediately clear
if they are intended to be qualified by the namespace associated with the
empty prefix (i.e. unprefixed) or not qualified without scanning the
namespace bindings in the element's attributes. This breaks 1). To keep
things simple, it is best to either use or not use namespaces, but mixing
and matching is as frought with problems as is binding the same prefix to
different namespaces in different places within the same document.

Jonathan


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.