I am trying to write an XML document (shown below) into a pandas dataframe. I am using df = pd.read_xml(doc.xml, xpath='//Generator)' but i keep getting an error saying ValueError: xpath does not return any nodes. Be sure row level nodes are in xpath. If document uses namespaces denoted with xmlns, be sure to define namespaces and use them in xpath.I have also tried adding the xmlns=url and xmlns:xsi=url to namespace= parameters with no luck. I can't seem to figure out what I am doing wrong. Any help would be greatly appreciated.
My XML document looks like this:
<?xml-stylesheet type="text/xsl" href="url"?>
<IMODocument docID="document" xmlns="url" xmlns:xsi="url" xsi:schemaLocation="url">
<IMODocHeader>
<DocTitle>
Generators Output and Capability Report
</DocTitle>
<DocRevision>
4
</DocRevision>
<DocConfidentiality>
<DocConfClass>
PUB
</DocConfClass>
</DocConfidentiality>
<CreatedAt>
2021-08-18T10:15:50
</CreatedAt>
</IMODocHeader>
<IMODocBody>
<Date>
2021-08-18
</Date>
<Generators> //Portion i'm trying to write into a data frame
<Generator>
</Generator>
<Generator>
</Generator>
<Generator>
</Generator>
<Generator>
</Generator>
<Generator>
</Generator>
<Generator>
</Generator>
<Generator>
</Generator>
</Generators> // ----------------end-------------------
</IMODocBody>
</IMODocument>```