Example #1
0
def _parse_xml(file, name):
    root = utils.ET.parse(file).getroot()
    if root.tag != "keywordspec":
        # TODO: XML validation errors should be logged
        return [], ""
    kw_nodes = root.findall("keywords/kw") + root.findall("kw")
    source_type = root.get("type")
    if source_type == "resource":
        source_type += " file"
    return [_XMLKeywordContent(node, name, source_type) for node in kw_nodes]
Example #2
0
def _parse_xml(file, name):
    root = utils.ET.parse(file).getroot()
    if root.tag != 'keywordspec':
        # TODO: XML validation errors should be logged
        return [], ''
    kw_nodes = root.findall('keywords/kw') + root.findall('kw')
    source_type = root.get('type')
    if source_type == 'resource':
        source_type += ' file'
    return [_XMLKeywordContent(node, name, source_type) for node in kw_nodes]
def _parse_xml(file, name):
    root = utils.ET.parse(file).getroot()
    if root.tag != 'keywordspec':
        # TODO: XML validation errors should be logged
        return [], ''
    kw_nodes = root.findall('keywords/kw') + root.findall('kw')
    source_type = root.get('type')
    if source_type == 'resource':
        source_type += ' file'
    return [_XMLKeywordContent(node, name, source_type) for node in kw_nodes]