I am currently taking part in a Cyber Challenge, however I have beeen asked to produce an xml file which contains nodes and atributes:
Generate a valid xml file at /tmp/vulnerable-countries.xml.
It should contain a list of country nodes attached to a root node
that have name attributes, the third node should be Panama.
I have looked everywhere for information on this and I cam up with the following. However, after submitting this code I get the following:
import xml.etree.cElementTree as ET
root = ET.Element("root")
ET.SubElement(root, "Country")
ET.SubElement(root, "Country")
ET.SubElement(root, "Panama")
tree = ET.ElementTree(root)
tree.write("/tmp/vulnerable-countries.xml")
Format of /tmp/vulnerable-countries.xml was not correct. It should contain 3 country nodes with name attributes, with the third being Panama.
Can anyone help?