LIDC-IDRI-processing icon indicating copy to clipboard operation
LIDC-IDRI-processing copied to clipboard

bug for lidcXmlHelper.py

Open Zouxxyy opened this issue 4 years ago • 0 comments

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

Zouxxyy avatar Dec 15 '21 14:12 Zouxxyy