tags traditionally are closed by other block-level elements. 4. Run through all nodes and check children for proper order (especially important for tables). 5. Validate attributes according to more restrictive definitions based on the RFCs. 6. Translate back into a string. (Generator) HTML Purifier is best suited for documents that require a rich array of HTML tags. Things like blog comments are, in all likelihood, most appropriately written in an extremely restrictive set of markup that doesn't require all this functionality (or not written in HTML at all).