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)
I tried following code using lxml:
Note: `ele_root` is generated by some other code.
1. ee(ele_ root) in_one_ file_name, 'wb') as output_file: write(output_ file, pretty_print=True, xml_declaration =True, encoding='utf-8',
doctype= '<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">')
tree = etree.ElementTr
with open(all_
tree.
2. ee(ele_ root) all_in_ one_file_ name, pretty_print=True, xml_declaration =True, encoding='utf-8',
doctype= doctype)
tree = etree.ElementTr
tree.write(