import xml.etree.ElementTree as ET
import pandas as pd
# parse the XML file
tree = ET.parse('your_file.xml')
root = tree.getroot()
# create an empty list to store the data
data = []
# iterate through all elements in the XML file
for element in root.iter():
# store the element and its text in a tuple and append to the data list
data.append((element.tag, element.text))
# iterate through all attributes of the element
for attribute in element.attrib:
# store the attribute and its value in a tuple and append to the data list
data.append((f'{element.tag} - {attribute}', element.attrib[attribute]))
# create a pandas dataframe from the data list
df = pd.DataFrame(data, columns=['Element/Attribute', 'Text'])
# print the dataframe
print(df.to_string(index=False))