[lxml-dev] Simple doctypes not in docinfo.doctype

F Wolff friedel at translate.org.za
Mon Sep 29 12:49:15 CEST 2008


Hallo list

I've hit a snag with lxml and a DOCTYPE decleration. I don't know if I'm
to blame here, but would appreciate help either way.

I've tried this with an old (1.3.2) and newer (2.0.6) lxml version.

(this example is roughly based on the code at
http://codespeak.net/lxml/tutorial.html)

from lxml import etree
from StringIO import StringIO
tree = etree.parse(StringIO("""<!DOCTYPE TS><TS></TS>"""))
tree.docinfo.doctype
''

>From my understanding this DOCTYPE declaration is valid (and occurring
in the wild in Qt .ts files). My real issue is round-trip problems in a
reading-writing cycle where the DOCTYPE is lost, but I guess not being
able to use .docinfo.doctype is already a problem.

Any help will be appreciated.

Keep well
Friedel

--
Recently on my blog:
http://translate.org.za/blogs/friedel/en/content/vrot-mango



More information about the lxml-dev mailing list