lxml returns an empty list on DTD attributes
Question: I'm trying to get the attributes of a DTD element to get their default values
but attributes() is returning always an empty list. Here is the code:

    
    
    #!/usr/bin/python3 -BEOObbs
    # coding=utf-8
    
    import io, lxml.etree
    
    xml = lxml.etree.parse(io.BytesIO(b'''<?xml
        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.internalDTD.elements()[0]
    print(element.name)
    print(element.attributes())
    

This is the result:

    
    
    sworddragon@ubuntu:~/tmp$ ./test.py
    test
    []
    

I'm wondering what is wrong here.


Answer: I have opened a ticket for this
(<https://bugs.launchpad.net/lxml/+bug/1266171>) and they have confirmed this
as a bug and even committed a fix into the master tree of the git repository
so the changes will be in the final 3.3.0 release of lxml.

