Simplify and improve performance of documentation tree traversal.

By directly using the node interface instead of converting to a DOM tree.