ParseXML.py 466 B

123456789101112131415161718
  1. import xml.etree.ElementTree as ET
  2. def ParseXML(path_xml):
  3. """
  4. Parses an XML File
  5. It is assumed, that packets are placed on the second hierarchical level and packetinformation encoded as attributes
  6. :param path_xml: Path to the XML File
  7. :return List of Dictionaries, each Dictionary contains the information for one packet
  8. """
  9. tree = ET.parse(path_xml)
  10. root = tree.getroot()
  11. packets = []
  12. for child in root:
  13. packets.append(child.attrib)
  14. return packets