1. A method to generate an effective schema of an electronic document for optimizing the processing thereof, comprising: performing a programmatic analysis to determine required portions of the electronic document prior to generating a parser to generate an optimized document model, wherein the performing programmatic analysis comprises: beginning at a document root path; proceeding into a template matching a root corresponding to the document root path; setting a current context as the root; determining portions of the document required to compute an expression, wherein determining portions of the document required to compute an expression comprises: identifying an xs1:value-of expression as requiring a string-value of a first node in a node set selected by a specified path through the document; identifying an xs1:for-each expression as requiring portions of the document necessary to evaluate a select expression of the xs1:for-each expression as well as a body of the xs1:for-each expression; identifying an xs1:choose expression as requiring portions of the document necessary to evaluate any tests, handlers and default clause; identifying an xs1:call-template expression as requiring portions of the document necessary to evaluate any parameter and to evaluate a body of the called template determined by the xs1:call-template expression, wherein template body uses are recomputed for each template call in response to multiple calls to a template in the document with different document portions being bound to parameters, and wherein document use of a definition will be recursive in response to the xs1:call-template being one of recursive and mutually recursive; and requiring a path into a document tree specified by a path expression; generating the optimized document model; and specializing a document processing program against the optimized document model.
1. A method to generate an effective schema of an electronic document for optimizing the processing thereof, comprising: performing a programmatic analysis to determine required portions of the electronic document prior to generating a parser to generate an optimized document model, wherein the performing programmatic analysis comprises: beginning at a document root path; proceeding into a template matching a root corresponding to the document root path; setting a current context as the root; determining portions of the document required to compute an expression, wherein determining portions of the document required to compute an expression comprises: identifying an xs1:value-of expression as requiring a string-value of a first node in a node set selected by a specified path through the document; identifying an xs1:for-each expression as requiring portions of the document necessary to evaluate a select expression of the xs1:for-each expression as well as a body of the xs1:for-each expression; identifying an xs1:choose expression as requiring portions of the document necessary to evaluate any tests, handlers and default clause; identifying an xs1:call-template expression as requiring portions of the document necessary to evaluate any parameter and to evaluate a body of the called template determined by the xs1:call-template expression, wherein template body uses are recomputed for each template call in response to multiple calls to a template in the document with different document portions being bound to parameters, and wherein document use of a definition will be recursive in response to the xs1:call-template being one of recursive and mutually recursive; and requiring a path into a document tree specified by a path expression; generating the optimized document model; and specializing a document processing program against the optimized document model. 10. The method of claim 1 , wherein performing a programmatic analysis to determine required portions of the electronic document comprises determining used portions of the document via a whole-program data use analysis.