It works fine as long as the XML files don't have <?xml version="1.0" encoding="UTF-8"?>
and the DOCTYPE tags. I would switch to xml.etree but I already wrote quite a lot of code using minidom. The same thing works in Python.
It sounds like a bug in Jython's minidom, but is there a way to work around it?