10. The computer implemented method of claim 1 , wherein the wildcard is xs:anyType.
1. A computer implemented method comprising the following computer executable acts: receiving a query written in XQuery for execution over an XML data collection retained in a computer-readable storage device, the query comprising at least one query expression, the at least one query expression comprising at least one of an element or an attribute; responsive to receiving the query, accessing at least one XML schema for the XML data collection, wherein the XML schema specifies a content model, the content model specifying that that the at least one of the element or the attribute in the XML schema is typed through use of a wildcard; identifying a section in the XML data collection that includes the at least one of the element or the attribute as a lax validation section; mapping the lax validation section of the XML schema into a XQuery type system; subsequent to mapping the lax validation section of the XML schema into the XQuery type system, automatically inferring a type for the at least one query expression such that the type for the at least one query expression is restricted from being typed with a wildcard; and subsequent to inferring the type for the at least one query expression, annotating the type inferred for the at least one query expression with at least one constraint.