OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   re: Re: Namespace prefixes optional?

[ Lists Home | Date Index | Thread Index ]
  • From: rev-bob@gotc.com
  • To: xml-dev <xml-dev@ic.ac.uk>
  • Date: 09 Jan 00 17:57:45 -0500

> 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@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS