1. A method implemented by a sending computer, the method comprising: identifying a template that defines a structure for a block of mark-up language wherein the block of mark-up language has an associated document type and wherein the block of mark-up language comprises: a plurality of elements; a plurality of sets of tags; and a plurality of data items; wherein individual ones of the plurality of elements each comprise: a particular set of tags from the sets of tags; and a particular data item from the plurality of data items; parsing the template to build a first logical tree that represents a structure of the plurality of sets of tags in the block of mark-up language, wherein the structure defines: relative locations of sets of tags of fixed elements, which are present and occur a fixed number of times in the block of mark-up language; relative locations of sets of tags of optional elements, which may or may not be present, and if present, occur only one time in the block of mark-up language; relative locations of sets of tags of variable elements, which are present and may occur any number of times in the block of mark-up language; and relative locations of sets of tags of variably optional elements, which may or may not be present, and if present, may occur any number of times in the block of mark-up language; sending the template to a receiving computer, thereby enabling the receiving computer to build a second logical tree that is identical to the first logical tree; identifying a document block having the document type, such that: the document block comprises: a plurality of document elements; a plurality of sets of document tags; and a plurality of document data items; wherein individual ones of the plurality of document elements each comprise: a particular set of document tags from the plurality of sets of document tags; and a particular document data item from the plurality of document data items; a structure of the plurality of sets of document tags in the document block is represented by the first logical tree such that each individual document element of the plurality of document elements is one of: a fixed document element corresponding to a fixed element, as defined by the first logical tree; an optional document element corresponding to an optional element, as defined by the first logical tree; a variable document element corresponding to a variable element, as defined by the first logical tree; or a variably optional document element corresponding to a variably optional element, as defined by the first logical tree, encoding the document block using the first logical tree by: for each document element in the document block, separating the set of document tags of the document element from the document data item of the document element, resulting in a structure component of the document block and a data component of the document block, wherein the structure component of the document block is distinct from the data component of the document block; for each fixed document element in the document block, removing from the structure component of the document block, the set of document tags of the fixed document element; for each optional document element in the document block, replacing in the structure component of the document block, the set of document tags of the optional document element with an indicator that the optional document element is present; for each optional element indicated in the first logical tree, but not present in the document block, adding to the structure component of the document block, an indicator that the optional element is not present; for each variable document element in the document block: determining a number of times that the variable document element appears in the document block; adding to the structure component of the document block, an indicator of the number of times that the variable document element appears in the document block; and removing from the structure component of the document block, the set of document tags associated with each occurrence of the variable document element; for each variably optional document element in the document block: determining a number of times that the variably optional document element appears in the document block; adding to the structure component of the document block, an indicator of the number of times that the variably optional document element appears in the document block; and removing from the structure component of the document block, the set of document tags associated with each occurrence of the variably optional document element; and for each variably optional element indicated in the first logical tree, but not present in the document block, adding to the structure component of the document block, an indicator that the variably optional element is not present, such that the structure component of the document block, when fully encoded, does not include any sets of document tags, does not include any representation of fixed elements, and comprises: indicators of the number of times that variable document elements appear in the document block; indicators of the number of times that variably optional elements appear in the document block; and indicators of variably optional elements that are not present in the document block; and sending the encoded structure component of the document block and the data component of the document block from the sending computer to the receiving computer with an indication of the document type, thereby enabling the receiving computer to use the second logical tree to decode the encoded document block.