I want to transform my XML file into a dataframe pandas I tried this code
import pandas as pd
from bs4 import BeautifulSoup
soup = BeautifulSoup(open("C:/Users/user/Desktop/essai/dataXml.xml", "r"),"xml")
d = {}
for tag in soup.RECORDING.find_all(recursive=False):
d[tag.name] = tag.get_text(strip=True)
df = pd.DataFrame([d])
print(df)
and this is a portion of my XML data
<?xml version="1.0" encoding="utf-8"?>
<sentences>
<sentence>
<text>We went again and sat at the bar this time, I had 5 pints of guinness and not one buy-back, I ordered a basket of onion rings and there were about 5 in the basket, the rest was filled with crumbs, the chili was not even edible.</text>
<aspectCategories>
<aspectCategory category="place" polarity="neutral"/>
<aspectCategory category="food" polarity="negative"/>
</aspectCategories>
</sentence>
</sentences>`
and I got this error
for tag in soup.RECORDING.find_all(recursive=False):
AttributeError: 'NoneType' object has no attribute 'find_all'
How can I fix it?
and thank you in advance
edit:
replacing soup.RECORDING.find_all with soup.find_all fixed the error but still I don't get what I want

soup.RECORDING.find_allinstead of justsoup.find_all?