There are as many reasons to query XML as there are reasons to use XML. Some examples of common uses for the XQuery language are:
1) Extracting information from a relational database for use in a web service.
2) Generating reports on data stored in a database for presentation on the web as XHTML.
3) Searching textual documents in a native XML database and presenting the results.
4) Pulling data from databases or packaged software and transforming it for application integration.
5) Combining content from traditionally non-XML sources to implement content management and delivery.
6) Ad hoc querying of standalone XML documents for the purposes of testing or research.