1. A computer implemented method comprising: receiving a markup language document specifying a user interface for interacting with a user; representing the markup language document using a hierarchical structure of nodes representing elements of the markup language document and edges connecting the nodes, wherein the hierarchical structure comprises: a subset of nodes mapped to node types; a mapping from node types to sets of handler functions; and a root node connected with other nodes via paths comprising nodes and edges; receiving a user input associated with a selected node; identifying sets of handlers associated with node types of nodes encountered in a path connecting the root node with the selected node; selecting a set of handlers for execution by determining an intersection of the identified sets of handlers; and executing handlers from the set of handlers selected for execution.