A system and method for processing documents, such as XML documents,
wherein the method includes the steps of: receiving a query comprising
search criteria; receiving at least a portion of a document; modifying
the search criteria such that constraints specifying a backward relation
may be reformulated into constraints specifying a forward relation;
processing the document using the modified criteria; and locating one or
more nodes that satisfy the search criteria; and, emitting the selected
nodes as output.