We're all accustomed to the speed by which a browser renders a web document. We're also accustomed to the fact that before the DOM is ready to be used the browser must download all the dependencies of a document. But what happens behind the scenes? Here's an excerpt taken from the documentation of Firefox's parser component:
Once the tokenization process is complete, the parse-engine needs to emit its content (tokens). Since the parser doesn't know anything about the document model, the containing application must provide a "content-sink". The sink is a simple API that accepts a container, leaf and text nodes, and constructs the underlying document model accordingly. The DTD interacts with the sink to cause the proper content-model to be constructed based on the input set of tokens.