XML Python: File Output Structure



I would need to restructure the XML from an opensource. May I know what is the output for the XML below?



tree = ET.ElementTree(ET.Element('data'))
root = tree.getroot()

for channel in channel_info:
chan = ET.SubElement(root, 'channel', {'name' : channel})
ET.SubElement(chan, 'size').text = str(channel_info[channel].size)
ET.SubElement(chan, 'toggle').text = '1' if channel_info[channel].toggle else '0'
ET.SubElement(chan, 'connect').text = '1' if channel_info[channel].connect else '0'

for name in channel_info[channel].trusted:
ET.SubElement(chan, 'trusted', {'name':name})

No comments:

Post a Comment