def __gen_node_href(self, layer, node_id):
        """
        generates a complete xlink:href for any node (token node,
        structure node etc.) in the docgraph. This will only work AFTER
        the corresponding PAULA files have been created (and their file names
        are registered in ``self.paulamap``).
        """
        if istoken(self.dg, node_id):
            base_paula_id = self.paulamap['tokenization']
        else:
            base_paula_id = self.paulamap['hierarchy'][layer]
        return '{0}.xml#{1}'.format(base_paula_id, node_id)