[New-bugs-announce] [issue12883] xml.sax.xmlreader.AttributesImpl allows empty string as attribute names

Michael Sulyaev report at bugs.python.org
Fri Sep 2 12:04:02 CEST 2011


New submission from Michael Sulyaev <msulyaev at gmail.com>:

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

----------
components: XML
messages: 143391
nosy: Michael.Sulyaev
priority: normal
severity: normal
status: open
title: xml.sax.xmlreader.AttributesImpl allows empty string as attribute names
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12883>
_______________________________________


More information about the New-bugs-announce mailing list