@staticmethod
def getNodeFromPath(path, root):
    """Obtains DOM node in schema at specified path. If a reference node
        is provided, the path is assumed to be relative to the reference node.
        If no reference node is provided, the path is assumed absolute, that is,
        relative to the schema root element."""
    for childname in path:
        if childname == '..':
            root = root.parentNode
            assert root.nodeType != root.DOCUMENT_NODE, 'Cannot go up one level; already at the schema root.'
        elif childname != '' and childname != '.':
            for root in root.childNodes:
                if (root.nodeType == root.ELEMENT_NODE and root.localName ==
                    'element' and root.getAttribute('name') == childname):
                    break
            else:
                return None
    return root
