Write a script to parse an input file and create a tree of HTML elements and their leaf nodes.