xml.etree.ElementTree doesn't use default values from DOCTYPE
CPython (3.5-3.9) correctly uses default values, whereas PyPy doesn't. For example:
foo.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Foo [
<!ELEMENT foo (bar*)>
<!ELEMENT bar (#PCDATA)*>
<!ATTLIST bar xml:lang CDATA "eng">
]>
<foo>
<bar>qux</bar>
</foo>
foo.py
:
import xml.etree.ElementTree as ET
with open("foo.xml") as f:
root = ET.parse(f).getroot()
print(root[0].attrib)
$ python3 --version
Python 3.9.0+
$ pypy3 --version
Python 3.6.9 (7.3.2+dfsg-2, Sep 26 2020, 23:01:23)
[PyPy 7.3.2 with GCC 10.2.0]
$ python3 foo.py
{'{http://www.w3.org/XML/1998/namespace}lang': 'eng'}
$ pypy3 foo.py
{}