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

Re: Namespace: what's the correct usage?

  • From: David Carlisle <davidc@n...>
  • To: marting@d...
  • Date: Sun, 20 May 2001 09:30:51 +0100

correct usage of the internet
  Your last paragraph conjures up all sorts of great images! I don't really
  anticipate the stuff I generate being used in other documents as most of it
  is transient messages. Either way the xmlns='' of the parent will help
  protect the child elements from subversive forces ;-)

No the xmlns="" just makes explicit that these elements are not
"protected" by a namespace. You are losing all the value of the
namespace rec in giving a possibility of generating unique element
names.

for example an XPath of //x:parent will only match your parent 
element if x: is bound to your namespace, but your child elements
are just in with the general mess so are matched with //child
an XPath that might have been intended for some completely different
document type. The whole point of the namespace REC is to avoid such
acidental clashes and have each element name unambiguously tied to its
namespace. 

There is a local scoping happening but it is the bindings of prefixes
(or non-prefix) to namespaces that is scoped. Your use of the unprefixed
element names to mean the namespace of the most recently declared prefix
is completely at odds with the interpretation specified in the namespace
rec.

why add xmlns="" to the parent and not xmlns="the namespace of the parent"
If you did the latter, your instance documents would look more or less
the same, with no prefixes on the children, and your  elements would all
be in the same namespace, which is a lot more natural.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp

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.