When I read the tcia-lidc-xml of LIDC-IDRI dataset, I found that some xml files could not be read normally,
after I replaced this code, it worked.
before
it = ET.iterparse(filepath)
for _, el in it:
if '}' in el.tag:
el.tag = el.tag.split('}', 1)[1] # strip all namespaces
for at in el.attrib.keys(): # strip namespaces of attributes too
if '}' in at:
newat = at.split('}', 1)[1]
el.attrib[newat] = el.attrib[at]
del el.attrib[at]
after
it = ET.iterparse(filepath)
for _, el in it:
prefix, has_namespace, postfix = el.tag.partition('}')
if has_namespace:
el.tag = postfix # strip all namespaces
When I read the
tcia-lidc-xml
of LIDC-IDRI dataset, I found that some xml files could not be read normally,after I replaced this code, it worked.
before
after