title: Saxon s9api: When to expect TinyDocumentImpl vs DocumentImpl
body: <p>My company makes heavy use of XSLT in our product, and we're about to migrate away from Java's javax.xml API and to Saxon's s9api. Because of this, I've been tasked with exploring the new API and figuring out what changes we need to make.</p>
  <p>One of the big things that is bugging me is the Saxon NodeInfo. Specifically, for whole XML documents, there are two implementations: TinyDocumentImpl, and DocumentImpl. They do not share a common API, and I have yet to find good documentation on when to use either one.</p>
  <p>So my question is: when should I expect one versus the other? What kind of rules determine which one is returned by a given Saxon operation?</p>
  <p>An extra point: so far in my experimentation, I see TinyDocumentImpl whenever I use the Saxon DocumentBuilder to load in a document, but I have seen DocumentImpl as the NodeInfo underlying the XdmNode parameter of a MessageListener2 implementation, which receives the output of an xsl:message.</p>