2 Answers
2

A while back I tried to do something similar and wasn't able to find a solution. I finally wrote the script below which opens the XML file and looks for a DTD using a regex. It also has an override to take the DTD path on the command line, which was a requirement I had.

If lxml handles nested DTDs then the code below should work for you.

To be honest I thought it was a bit of a hack to read the file myself, but it was the only way I found.