def parseXML(self):
    assert self.filepath.endswith(XML_EXT), 'Unsupport file format'
    parser = etree.XMLParser(encoding=ENCODE_METHOD)
    xmltree = ElementTree.parse(self.filepath, parser=parser).getroot()
    filename = xmltree.find('filename').text
    try:
        verified = xmltree.attrib['verified']
        if (verified == 'yes'):
            self.verified = True
    except KeyError:
        self.verified = False
    for object_iter in xmltree.findall('object'):
        bndbox = object_iter.find('bndbox')
        label = object_iter.find('name').text
        parents = object_iter.find('has_parents')
        children = object_iter.find('has_children')
        object_id = int(object_iter.find('object_id').text)
        difficult = False
        if (object_iter.find('difficult') is not None):
            difficult = bool(int(object_iter.find('difficult').text))
        self.addShape(label, bndbox, difficult, parents, children, object_id)
    return True
def parseXML(self):
    assert self.filepath.endswith(XML_EXT), 'Unsupport file format'
    parser = etree.XMLParser(encoding=ENCODE_METHOD)
    xmltree = ElementTree.parse(self.filepath, parser=parser).getroot()
    filename = xmltree.find('filename').text
    try:
        verified = xmltree.attrib['verified']
        if (verified == 'yes'):
            self.verified = True
    except KeyError:
        self.verified = False
    for object_iter in xmltree.findall('object'):
        bndbox = object_iter.find('bndbox')
        label = object_iter.find('name').text
        parents = object_iter.find('has_parents')
        children = object_iter.find('has_children')
        object_id = int(object_iter.find('object_id').text)
        difficult = False
        if (object_iter.find('difficult') is not None):
            difficult = bool(int(object_iter.find('difficult').text))
        self.addShape(label, bndbox, difficult, parents, children, object_id)
    return True