26. The non-transitory machine readable medium of claim 24 , wherein the identified particular region shares at least one border with at least two of the additional encompassed regions.
24. A non-transitory machine readable medium storing a program which when executed by at least one processing unit analyzes a document comprising a plurality of primitive elements and generates structural elements that define structure in the document based on the analysis, the program comprising sets of instructions for: identifying regions that comprise sets of primitive elements, the regions arranged in a hierarchy such that a first parent region comprising a first set of primitive elements encompasses a second child region comprising a second set of primitive elements, the second set of primitive elements a subset of the first set of primitive elements; determining that a particular region (i) is rectangular, (ii) encompasses at least two additional rectangular child regions, and (iii) only shares borders with the additional rectangular child regions; identifying the particular region as a table and the encompassed child regions as cells of the table; and defining a tabular structural element based on the table, the tabular structural element comprising a plurality of cells arranged in a plurality of rows and columns, each cell comprising an associated set of primitive elements.