'Generator, yields dicts for nodes found as described in the options.'

def generate_import_record(self, filename, bulkload_state):

    self.bulkload_state = bulkload_state
    tree = ElementTree.parse(filename)
    xpath_to_nodes = self.xpath_to_nodes
    if ((len(xpath_to_nodes) > 1) and (xpath_to_nodes[0] == '/') and (xpath_to_nodes[1] != '/')):
        if (not (tree.getroot().tag == xpath_to_nodes.split('/')[1])):
            return
        xpath_to_nodes = ('/' + xpath_to_nodes.split('/', 2)[2])
    nodes = tree.findall(xpath_to_nodes)
    for node in nodes:
        if (self.xml_style == self.ELEMENT_CENTRIC):
            input_dict = {}
            for child in node.getchildren():
                if (not (child.tag in input_dict)):
                    input_dict[child.tag] = child.text
        else:
            input_dict = dict(node.items())
        input_dict['__node__'] = node
        (yield input_dict)
