'Constructor.
Args:
xpath_to_nodes: xpath to the nodes to run over.
xml_style: ELEMENT_CENTRIC or ATTRIBUTE_CENTRIC--we\'ll
either convert the list of elements to a dict (last element of the same
name will be used) or the list of attributes.
Raises:
InvalidConfiguration: If the config is invalid.'

def __init__(self, xpath_to_nodes, xml_style):

    self.xpath_to_nodes = xpath_to_nodes
    assert (xml_style in (self.ELEMENT_CENTRIC, self.ATTRIBUTE_CENTRIC))
    self.xml_style = xml_style
    self.output_stream = None
    self.bulkload_state = None
    self.depth = 0
    if re.match(NODE_PATH_ONLY_RE, xpath_to_nodes):
        self.node_list = self.xpath_to_nodes.split('/')[1:]
        self.entity_node = self.node_list[(-1)]
        self.node_list = self.node_list[:(-1)]
    else:
        self.node_list = None
        self.entity_node = None
        self.node_list = None
