1. A method for searching a document for a query pattern, the method comprising: representing the document by a plurality of streams, wherein each of the streams is uniquely associated with one element label in the document and with all nodes in a data tree representation of the document associated with the element label; defining a plurality of disjoint sub-trees in the data tree; correlating one or more sub-streams of the streams with a respective different one or more disjoint sub-trees such that all nodes of each of the sub-streams belong to a respective disjoint sub-tree; searching for the query pattern by executing a plurality of threads, wherein each of the threads is used to search different one or more sub-streams; and generating a result of the query pattern search using at least one of the threads.