[XML-SIG] Empty string namespace - to bug or not to bug?

Thomas B. Passin tpassin at comcast.net
Mon Oct 13 11:49:51 EDT 2003


Andrew Clover wrote:
> Alexis Marrero wrote:
> 
> 
>>Is this a bug?
> 
> 
>>doc = minidom.parseString('<root xmlns="">value</root>')
>>doc.toxml()
> 
> 
> IMO yes, but the bug occurs before doc.toxml. After the
> parseString call, doc.documentElement.attributes.item(0).value
> evaluates to None instead of '' (and it is this that causes the
> later exception).
> 

However, the empty namespace is _supposed_ to be represented by None. 
So the bug actually occurs in whatever code still thinks (from long ago) 
that it should be an empty string instead.


> I suspect this code in expatbuilder.py, line 764:
> 
>   d = a.childNodes[0].__dict__
>   d['data'] = d['nodeValue'] = uri
>   d = a.__dict__
>   d['value'] = d['nodeValue'] = uri
> 
> Adding:
> 
>   if uri is None:
>     uri= ''
> 
> immediately preceding this code seems to fix the problem, though
> I haven't investigated whether this is the best way of doing it.
> 
> Add to bug tracker [Y|N]?
> 

N (better to fix the real problem, which is apparently not here).

Cheers,

Tom P





More information about the XML-SIG mailing list