[Home] [By Thread] [By Date] [Recent Entries]

  • To: David Megginson <dmeggin@a...>
  • Subject: Re: Re: [Sax-devel] Showstopper issue with new Attributetext
  • From: Robin Berjon <robin.berjon@e...>
  • Date: Wed, 17 Mar 2004 16:22:26 +0100
  • Cc: XML Developers List <xml-dev@l...>,SAX Developers' List <sax-devel@l...>
  • In-reply-to: <405864E7.3090505@a...>
  • References: <OF24BFF179.96E54E23-ON85256E54.0050C5B0-85256E54.0051D5E1@c...> <p06010200bc7630593567@[192.168.254.4]> <405864E7.3090505@a...>
  • User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4

David Megginson wrote:
> OK, people, what do we do here?  Here are my opinions:
> 
> 1. Anyone who writes an application that actually cares about the 
> Namespace assigned to xmlns attributes is f#@$%@#$ed in the head and 
> deserves whatever happens.
> 
> 2. That said, we still have a responsibility to try to do the right 
> thing. If we get it wrong, though, it doesn't matter all that much (see 
> #1).

One may indeed be fuxored in the head but one may simply be implementing 
a SAX handler that produces a DOM. In that case, well, you just need to 
know (and I suspect that would translate equally to other 
representations of the Infoset, depending on which parts they decide to 
stick to and which they ditch). Head-fuxoring is transitive.

> So, bearing all that in mind, what should we report for the following 
> Namespace declaration?
> 
>   <foo xmlns="http://www.example.org/ns#"/>
> 
> a) an attribute with no Namespace URI and the local name "xmlns";
> 
> b) an attribute with the Namespace URI "http://www.w3.org/2000/xmlns/" 
> and no local name; or
> 
> c) an attribute with the Namespace URI "http://www.w3.org/2000/xmlns/" 
> and the local name "xmlns".
> 
> Note that none of these is a clean solution, probably because Namespaces 
> 1.1 is a bit broken.  Then again, I doubt it matters much.  If no one 
> presents a convincing argument, I'll just pick one of the three at random.

Is consistency accross SAXes a convincing argument? PerlSAX settled this 
to be a) a while ago, on the grounds that ok it might not be the spec 
but having an attribute with no prefix have a namespace was taking it 
too far to our taste.

Quickly throwing together something:

use XML::SAX::ParserFactory;
use Data::Dumper;
XML::SAX::ParserFactory->parser(Handler=>bless[])->parse_string('<foo 
xmlns="hhh"/>');
sub start_element { print Dumper($_[1]->{Attributes}); }

produces:

$VAR1 = {
           '{}xmlns' => {
                          'LocalName' => 'xmlns',
                          'Prefix' => '',
                          'Value' => 'hhh',
                          'Name' => 'xmlns',
                          'NamespaceURI' => ''
                        }
         };


-- 
Robin Berjon

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member