1
내가 ElementTree는 XML 파일XML 파일에 XML 선언을 작성하는 방법은 무엇입니까?
for i in range(len(lang_list)):
body = ET.SubElement(root, "body")
body.set("lang", lang_list[i])
# body.text = text_list[i] + " " + common_text
body.text =unescape(escape('<![CDATA[')) + text_list[i] + " " + common_text + unescape(escape(']]>'))
body.tail = "\n\t"
outpath = os.getcwd()
file = outpath + "\\test.xml"
tree.write(file, xml_declaration=True)
쓰기 사용하여 현재 모르지만,하는 XML 선언이이 같은
DOCTYPE 이메일 템플릿 PUBLIC "-// yourcompany, Inc.//DTD 이메일 템플릿 // EN ""email-template.dtd ">
이 정보를 XML 파일에 쓰려면 어떻게해야합니까?
으로 마지막 줄을
을 교체하는 것입니다. 내 대답을 볼 수 있습니다 [여기] (https://gist.github.com/larsks/de0d32d3796609cd856da7b95e7e4808). – larsks