10. A method for processing an XML document associated with a schema, comprising: receiving a stream of discrete pieces of the XML document, wherein the stream of discrete pieces of the XML document contains one or more upstream discrete pieces of the XML document and a downstream discrete piece of the XML document; analyzing the schema associated with the XML document and using the schema to determine that the one or more upstream discrete pieces of the XML document are related to the downstream discrete piece of the XML document in the stream of discrete pieces of the XML document; keeping in memory said one or more upstream discrete pieces of the XML document before receiving the downstream discrete piece of the XML document from the stream; performing, via a matching component running on one or more processors, a match based on evaluating both the one or more upstream discrete pieces and the downstream discrete piece of the XML document after receiving the downstream discrete piece of the XML document; and passing the downstream discrete piece and the one or more upstream discrete pieces of the XML document to a user object for handling when the match is reached in the performing step.
10. A method for processing an XML document associated with a schema, comprising: receiving a stream of discrete pieces of the XML document, wherein the stream of discrete pieces of the XML document contains one or more upstream discrete pieces of the XML document and a downstream discrete piece of the XML document; analyzing the schema associated with the XML document and using the schema to determine that the one or more upstream discrete pieces of the XML document are related to the downstream discrete piece of the XML document in the stream of discrete pieces of the XML document; keeping in memory said one or more upstream discrete pieces of the XML document before receiving the downstream discrete piece of the XML document from the stream; performing, via a matching component running on one or more processors, a match based on evaluating both the one or more upstream discrete pieces and the downstream discrete piece of the XML document after receiving the downstream discrete piece of the XML document; and passing the downstream discrete piece and the one or more upstream discrete pieces of the XML document to a user object for handling when the match is reached in the performing step. 17. The method according to claim 10 , further comprising: keeping, cloning and destroying the entirety or a portion of a sub-tree descending from a node in the tree.