Patent ID: 7058884

Claim:
A computer-implemented method of restructuring an input HTML document to comply with strict HTML, said method comprising the steps of: (a) linearly traversing the input HTML document to create a hierarchical tree structure representation, the traversal maintaining a current insertion point for elements within the tree structure representation; (b) during the traversal, identifying elements of the input HTML document that violate strict HTML, and, for each identified element: (b)(I) retracing the tree structure representation from the current insertion point to identify a further insertion point from which the identified element can depend, the retracing comprising noting one or more elements passed during the retracing; (b)(ii) appending the identified element at the further insertion point; (b)(iii) creating new elements in the tree structure representation corresponding to the noted one or more elements passed during the retracing, the new elements being created in reverse chronological order to an order in which the noted one or more elements were passed during the retracing; and (b)(iv) appending each new element to the identified element as a link back element, wherein the link back element comprises a link to a corresponding noted element of the noted one or more elements; and (c) converting the tree structure representation into an output HTML document.