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

re: Re: Namespace prefixes optional?

  • From: rev-bob@g...
  • To: xml-dev <xml-dev@i...>
  • Date: 09 Jan 00 17:57:45 -0500

prefix for belonging to
> David Megginson wrote:
> > 
> > Here are the tricky points about Namespaces:
> > 
> > 1. Namespace URIs are just unique identifiers, like Java or Perl
> >    package names; they don't (necessarily) point to anything.
> > 
> > 2. There can be a default Namespace for element names but not for
> >    attribute names.
> > 
> > 3. Not withstanding #2, some apps may treat unprefixed attribute names
> >    as if they belong to the same Namespace as the corresponding
> >    element name.

Seems from here that a simple containment-based default scheme would avoid a lot of 
headaches in this matter.  That is, unless X has an explicit namespace, X defaults to the 
namespace of its parent - whether X is an attribute (parent = element) or an element 
(parent = containing element).  That certainly seemed to be what the XHTML spec 
implied; define the namespace for <html>, and everything contained within the html 
element defaults to the html namespace unless otherwise noted.

As it stands, I really don't like the idea of having to prefix each and every element name 
and attribute name with a namespace prefix just to ensure that the intent is clear.  
Defining the deltas ("here's where the namespace changes") seems *much* more 
logical...not to mention being easier to maintain and easier to read.  (Yeah, tacking a 
namespace onto every token may not seem like a big deal when generating a document 
- but have you ever tried to *modify* such a monstrosity?)

For a basic example of what I mean, in hopes of making my intentions clearer, take this 
fragment - assuming that all referenced namespaces have been defined, of course.

<rbns:fragment name="Fred" creator="Rev. Bob">
<name><first>Robert</first><last>Hood</last></name>
<htmlns:p align="left">Here's a bit of <b bubbans:foo="bar">XHTML</b> thrown into 
the mix.</p>
<name><first>Joe</first><last>Thomas</last></name>
</fragment>

What I am proposing would make that equal to this namespace-explicit fragment:

<rbns:fragment rbns:name="Fred" rbns:creator="Rev. Bob">
<rbns:name><rbns:first>Robert</rbns:first><rbns:last>Hood</rbns:last></rbns:name>
<htmlns:p htmlns:align="left">Here's a bit of <htmlns:b 
bubbans:foo="bar">XHTML</htmlns:b> thrown into the mix.</htmlns:p>
<rbns:name><rbns:first>Joe</rbns:first><rbns:last>Thomas</rbns:last></rbns:name>
</rbns:fragment>

That is, by defining "fragment" as belonging to namespace rbns, I am defining the 
attributes of "fragment" and the children of "fragment" as belonging to the same 
namespace by default.  With the "p" element, I declare that it belongs to the htmlns 
namespace, along with (by default) its children and attributes.  With the "b" element, for 
some reason, I need to attach an attribute from the bubbans namespace - so I mark just 
that attribute as belonging to a different space.  When "p" closes, so does the htmlns 
fragment, and the default namespace reverts back to rbns.

Simple enough?



 Rev. Robert L. Hood  | http://rev-bob.gotc.com/
  Get Off The Cross!  | http://www.gotc.com/

Download NeoPlanet at http://www.neoplanet.com


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



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.