classification
Title: xml.sax.xmlreader.AttributesImpl allows empty string as attribute names
Type: behavior Stage:
Components: XML Versions: Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Chenguang.Wang, Michael.Sulyaev, Ramchandra Apte
Priority: normal Keywords: patch

Created on 2011-09-02 10:04 by Michael.Sulyaev, last changed 2013-01-31 07:44 by Chenguang.Wang.

Files
File name Uploaded Description Edit
w.patch Chenguang.Wang, 2013-01-31 07:44 review
Messages (3)
msg143391 - (view) Author: Michael Sulyaev (Michael.Sulyaev) Date: 2011-09-02 10:04
I can get not-well-formed XML output (attribute name must not be empty string):

<?xml version="1.0" encoding="iso-8859-1"?>
<root ="v_for_empty_name" k1="v1"></root>

AttributeImpl must ignore dict entries that may not be cast to valid XML attributes.

Code:

#!/usr/bin/python

from xml.sax.xmlreader import AttributesImpl as Attrs
from xml.sax.saxutils import XMLGenerator as Gen

g = Gen()
a = Attrs(dict([('k1','v1'),('','v_for_empty_name')]))
g.startDocument()
g.startElement('root',a)
g.endElement('root')
g.endDocument()
print
msg180964 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2013-01-30 05:31
bump...
msg181008 - (view) Author: Chenguang Wang (Chenguang.Wang) Date: 2013-01-31 07:44
I found this problem is still not fixed in the lastest hg version. Seriously?

This patch is for the latest v3.4.0a0.
History
Date User Action Args
2013-01-31 07:44:27Chenguang.Wangsetfiles: + w.patch

nosy: + Chenguang.Wang
messages: + msg181008

keywords: + patch
2013-01-30 05:31:10Ramchandra Aptesetnosy: + Ramchandra Apte
messages: + msg180964
2011-09-02 10:04:02Michael.Sulyaevcreate