In a programming language setting, this is usually called an AST (Abstract Syntax Tree), not a DOM. Though I see what you're getting at here with the AST query API. There are certainly parallels. (<a href="http://en.wikipedia.org/wiki/Abstract_syntax_tree" rel="nofollow">http://en.wikipedia.org/wiki/Abstract_syntax_tree</a>)