Empty list is returned on DTD attributes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Fix Released
|
Medium
|
scoder |
Bug Description
The following code returns an empty attribute list on the DTD element test but it has an attribute in the xml document:
#!/usr/bin/python3 -BEOObbs
# coding=utf-8
import io, lxml.etree
xml = lxml.etree.
version='1.1'
encoding='utf-8'
?>
<!DOCTYPE root [
<!ATTLIST test
attr (A | B | C) 'B'
>
<!ELEMENT test (#PCDATA)>
<!ELEMENT root (test)*>
]>
<root></root>'''))
element = xml.docinfo.
print(element.name)
print(element.
This is the output:
sworddragon@
test
[]
Used versions:
Python : sys.version_
lxml.etree : (3, 3, 0, -98)
libxml used : (2, 9, 1)
libxml compiled : (2, 9, 1)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)
Thanks for the report and the test code. I can confirm this, and it applies only to internal/external subsets, not DTDs parsed independently. Working on a fix.