1. A method of enforcing application-layer policies to application layer formatted documents, each policy defining a rule and an action, comprising: distinctly storing simple policies and complex policies applicable to the application layer formatted documents in a simple policies data structure, wherein said simple policies data structure stores XPath queries that do not use wildcard “*” and descendent “//” expressions, and, respectively, a complex policies data structure, wherein said complex policies data structure stores XPath queries that use wildcard “*” and descendent “//” expressions; parsing a document received as streaming application layer data in a hierarchical structure, for enabling evaluation of an object in the document, wherein the document is an Extensible Markup Language (XML) document and the object is a result of evaluation of an XPath expression; simultaneously querying the simple and complex policies data structures to identify all policies corresponding to the object; discontinuing the query for the object in the simple and complex policies data structures once all of the simple and complex policies that match the object are identified; and executing the actions defined by the simple and complex policies corresponding to the object.