1. An apparatus comprising: a processor; a memory storing executable code that, when executed by the processor, is configured to cause the processor to: receive a query for one or more components of a document; receive events corresponding to the document; generate a forward axis graph based on the query and corresponding to an in-order traversal of the document as associated with the events, the forward axis graph including a plurality of nodes with edges connecting the nodes; identify, independently from the received events, a plurality of matching states of the forward axis graph including at least one final state, each matching state including a subset of one or more of the nodes wherein each incoming edge to the subset originates from one of the nodes of the subset; determine, independently from the received events, transitions between the matching states, wherein at least one of the transitions comprises a multiple event transition comprised of two incoming edges to the same node; and determine whether the final state is achieved based on which of the received events correspond to the multiple event transition and determine whether the one or more components of the query exist within the document based on whether the final state is achieved.