0

I know, that this way of dtd validation before parsing a xml file works:

    from lxml import etree
    context = etree.iterparse(PATH_TO_XML, dtd_validation=True, events=("start", "end"))

But how do I get this to work for the xml.etree.cElementTree.iterparse?

    from xml.etree.cElementTree import iterparse
    context = iterparse(PATH_TO_XML, ???, events=("start", "end"))
Aufwind
  • 25,310
  • 38
  • 109
  • 154

1 Answers1

2

cElementTree is not part of lxml. According to the cElementTree website, DTD Validation is not available to cElementTree.

Jacob
  • 41,721
  • 6
  • 79
  • 81
  • 1
    According to this [SO Question](http://stackoverflow.com/questions/270460/dtd-validation-with-python) DTD Validation is nto available to any builtin libraries. So you are stuck with lxml. – Jacob May 17 '11 at 09:11