[XML-SIG] [ pyxml-Bugs-421553 ] stylesheet node reader requires '' NSURI

Karl Anderson karl@digicool.com
08 May 2001 13:12:23 -0700


Can anyone shine some light on which DOM implementation is right here?
After parsing an attribute with no namespace prefix, what namespace
URIs should it be possible to retrieve that attribute with?

For example, after parsing "<spam version="1.0"/>" in a namespace
aware way, which should return "1.0":

getAttributeNS(None, 'version')
getAttributeNS('', 'version')

Only the URI of '' works for Domlette.  Only the URI of None works for
ParsedXML.  I think that ParsedXML's restriction is morally better
because of this line from the DOM rec:

> Note that because the DOM does no lexical checking, the
> empty string
> will be treated as a real namespace URI in DOM Level 2
> methods.
> Applications must use the value null as the
> namespaceURI parameter for
> methods if they wish to have no namespace.

OTOH, I've lost arguments when it was pointed out that you don't have
to use DOM methods when you're parsing, and in fact can't parse
everything if you're restricted to them.  OTOH again, using None would
make parsing consistent with setting namespaceless names using DOM
methods.

ParsedXML doesn't work for the XSLT modules in the current PyXML
checkout because they use '' as the NSURI to use to retrieve NSless
attributes.

Should ParsedXML allow names parsed without a NS to be retrieved
with a NSURI of '' as well as None?  Should Domlette allow None?
Should None be used in getAttributeNS calls like these, regardless?

noreply@sourceforge.net writes:

> Bugs item #421553, was updated on 2001-05-04 18:06
> You can respond by visiting: 
> http://sourceforge.net/tracker/?func=detail&atid=106473&aid=421553&group_id=6473
> 
> Category: 4Suite
> Group: None
> Status: Open
> Resolution: None
> Priority: 5
> Submitted By: Karl Anderson (karlanderson)
> Assigned to: Nobody/Anonymous (nobody)
> Summary: stylesheet node reader requires '' NSURI
> 
> Initial Comment:
> 
> I'm unable to use ParsedXML's DOM as a stylesheet node,
> and I think
> it's because of a bug in StylesheetReader.py.
> 
> The problem is at StylesheetReader.py line 186:
> 
>         if not sheet.getAttributeNS('', 'version'):
>             raise
> XsltException(Error.STYLESHEET_MISSING_VERSION)
> 
> ...where the NamespaceURI given to getAttributeNS is
> ''.  This is
> supposed to find the namespace-free version attribute
> of the
> stylesheet documentElement, such as
> """
> <xsl:stylesheet
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   version="1.0">
> """.
> 
> ParsedXML's DOM builder gives this attribute a
> NamespaceURI of None
> when we parse.
> 
> I don't think that you can use the DOM methods to
> create a node with a
> NamespaceURI of "", since the NamespaceURI is supposed
> to be a URI
> reference.  Is the empty string a valid URI reference? 
> Well, maybe -
> the DOM level 2 rec says:
> """
> Note that because the DOM does no lexical checking, the
> empty string
> will be treated as a real namespace URI in DOM Level 2
> methods.
> Applications must use the value null as the
> namespaceURI parameter for
> methods if they wish to have no namespace.
> """
> But anyway, this indicates that when using DOM creation
> methods, a
> None should be used as the NamespaceURI for
> namespaceless nodes such
> as "version", and I think that the stylesheet reader
> should accept
> that.
> 
> 
> ----------------------------------------------------------------------
> 
> You can respond by visiting: 
> http://sourceforge.net/tracker/?func=detail&atid=106473&aid=421553&group_id=6473
> 
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://mail.python.org/mailman/listinfo/xml-sig

-- 
Karl Anderson                          karl@digicool.com