11. A method for processing an XML document, comprising: parsing an XML document and generating a stream of discrete pieces of the XML document, wherein the XML document is represented using a hierarchical data structure, and each said discrete piece of the document is represented by one or more nodes in the hierarchical data structure; accepting a discrete piece of the XML document from the stream of discrete pieces from the streaming parser at one time; keeping in memory only said discrete piece of the XML document from the stream at said time; maintaining a plurality of contexts associated with the XML document in a context data structure, wherein each context of the plurality of contexts contains a node in the hierarchical data structure and a position of the node relative to a context node; mapping each context of the plurality of contexts to the stream of discrete pieces of the XML document and performing matching against each context of the plurality of contexts on said discrete piece of the XML document from the stream; passing the particular discrete piece of the XML document to a user object for handling when the particular discrete piece of the XML document is a matched discrete piece of the XML document.
11. A method for processing an XML document, comprising: parsing an XML document and generating a stream of discrete pieces of the XML document, wherein the XML document is represented using a hierarchical data structure, and each said discrete piece of the document is represented by one or more nodes in the hierarchical data structure; accepting a discrete piece of the XML document from the stream of discrete pieces from the streaming parser at one time; keeping in memory only said discrete piece of the XML document from the stream at said time; maintaining a plurality of contexts associated with the XML document in a context data structure, wherein each context of the plurality of contexts contains a node in the hierarchical data structure and a position of the node relative to a context node; mapping each context of the plurality of contexts to the stream of discrete pieces of the XML document and performing matching against each context of the plurality of contexts on said discrete piece of the XML document from the stream; passing the particular discrete piece of the XML document to a user object for handling when the particular discrete piece of the XML document is a matched discrete piece of the XML document. 13. The method according to claim 11 , further comprising: allowing at least one of the plurality of contexts maintained to be XPath context.