§ 3.2. Construction
The main (intentional) deviation of LaTeXML's digestion from that of TeX is in the extension of control sequences to include LaTeXML::Constructors responsible for constructing XML document fragments, and LaTeXML::Whatsits to represent thier digested form including whatever arguments were passed to the control sequence.
Construction thus consists of creating an LaTeXML::Document, containing an XML::LibXML::Document structure, and having it absorb the digested lists, boxes and whatsits. Generally, boxes represent text which is converted to text nodes within the document. Whatsits generally create a document fragment involving elements, attributes and text.
A LaTeXML::Model is maintained througout the digestion phase which accumulates
any document model declarations in particular the document type (currently only
the DTD, but eventually may be RelaxNG based). As LaTeX markup is more
like HTML than XML, declarations may be used to indicate which elements may
be automatically opened or closed when needed to build a document tree that matches
the document type. As an example, a <subsection> will automaticall be closed
when a <section> is begun.