Comment 2 for bug 1791945

Revision history for this message
Zhan Shiyan (zsynew) wrote :

I tried following code using lxml:

Note: `ele_root` is generated by some other code.

1.
tree = etree.ElementTree(ele_root)
with open(all_in_one_file_name, 'wb') as output_file:
    tree.write(output_file, pretty_print=True, xml_declaration=True, encoding='utf-8',
               doctype='<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">')

2.
tree = etree.ElementTree(ele_root)
tree.write(all_in_one_file_name, pretty_print=True, xml_declaration=True, encoding='utf-8',
                      doctype=doctype)