You've drawn a false dichotomy between document and tree. A tree is a mathematical abstraction, a document is a text-based file, and markup languages are the intersection of those. Web pages were always documents according to the HTML specification, as one of your replies linked to.