I would like to comment out a text like this:
<name>cranberry</name>
However, my script returns the output like this:
<!-- <name>cranberry</name> -->
My Script:
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Comment
tree = ET.parse(r"C:\sample.xml")
root = tree.getroot()
comment = ET.Comment("<name>cranberry</name>")
root.insert(0,comment)
tree.write(r"C:\sample1.xml")
Any advice would be appreciated.