1. A method to generate an effective schema of an electronic document for optimizing the processing thereof, comprising: performing a programmatic analysis on a document processing program, by a processor, to determine required portions of the electronic document for rendering the electronic document; generating a parser that generates the optimized document model based on the required portions of the electronic document; generating the optimized document model; optimizing the document processing program by specializing the document processing program against the optimized document model, wherein an operation of the document processing program that is associated with an unused member of the optimized document model is removed from the document processing program; and rendering the electronic document using the optimized document processing program with a shorter processing time and a reduced memory requirement than without optimization.
2. The method of claim 1 , further comprising determining if one of the required portions of the electronic document is being handled by tracking an encountered element against a set of required paths.