1. A method associated with a system for processing queries in an XML document, the method comprising: receiving at least one query expression, wherein the at least one query expression comprises one or more components, and wherein each of the components comprises at least one symbol; generating at least one index and a data structure, wherein the generated data structure is indicative of hierarchical relationships between the one or more components of the received at least one query expression, the generated data structure further defining respective lists of the one or more components having corresponding symbols and the index comprising a plurality of entries with at least one of the entries for each symbol of the received at least one query expression and wherein the generated at least one index relates each symbol of the received at least one query expression in a corresponding one of the entries to a corresponding component in the respective lists defined by the generated data structure; generating a plurality of tokens based on contents of the XML document; identifying one or more tokens that matches at least one symbol by comparing the plurality of tokens with the generated at least one index; for each of the identified one or more tokens: retrieving a respective list of matching components corresponding to the matched at least one symbol of the generated structure and marking each matching component of the respective list of matching components; and outputting data indicative of a match to the received at least one query expression subsequent to marking each of the components of the received at least one query expression.