1. A method comprising: receiving a query that requires one or more XML nodes that are binary-encoded; in response to receiving the query, requesting binary-encoded XML data from one or more data sources, wherein the binary-encoded XML data is a compact binary representation of textual XML data; determining that a particular node reflected in the binary-encoded XML data satisfies one or more criteria of the query; after determining that the particular node satisfies one or more criteria of the query and before extracting content of the particular node, determining whether the particular node is simple or complex, wherein a node is simple if the node has no child elements and no associated attributes, wherein a node is complex if the node has at least one child element or at least one attribute; if it is determined that the particular node is complex, then extracting, from the binary-encoded XML data, a scalar value of the particular node by performing a first set of one or more operations; if it is determined that the particular node is simple, then extracting, from the binary-encoded XML data, a scalar value of the particular node without performing the first set of one or more operations; wherein the method is performed by one or more computing devices.