I am trying to extract some information out of a tei file, using this code:
tree = ET.parse(path)
root = tree.getroot()
body = root.find("{http://www.tei-c.org/ns/1.0}text/{http://www.tei-c.org/ns/1.0}body")
for s in body.iter("{http://www.tei-c.org/ns/1.0}s"):
for w in s.iter("{http://www.tei-c.org/ns/1.0}w"):
wordpart = w.find("{http://www.tei-c.org/ns/1.0}seg")
word = ''.join(wordpart.itertext())
type = w.get('type')
xml = w.get('xml:id')
print(type)
print(xml)
The output for type
is correct, it prints e.g. "noun". But for xml:id
I can only get None
. This is an extract of the xml-file I need to parse:
<w type="noun" xml:id="w.4940"><seg type="orth">sloterheighe</seg>...