1. A method to query a compound XML document, the method comprising: receiving a compound XML document comprising a primary document, a first nested document, and a second nested document that is nested within the first nested document; determining a first encoding type associated with the first nested document and a second encoding type associated with the second nested document; generating a single query against the compound XML document, the query comprising an attribute and a first query element specifying the first encoding type, a first search term, and a first root node of the first nested document, the query further comprising a second query element specifying the second encoding type, a second search term, and a second root node of the second nested document; executing the query and decoding the first nested document and the second nested document; and receiving a first rowset from the first nested document and a second rowset from the second nested document, wherein executing the query comprises decoding the first nested document associated with the first encoding type to reveal contents of the first nested document and decoding the second nested document associated with the second encoding type to reveal contents of the second nested document and querying the contents of both revealed documents.