FOR XML EXPLICIT is a powerful, oft-maligned, somewhat daunting mode of SQL Server XML production. It allows for the shaping of row data in any desirable XML structure, but the SQL required to produce it can easily end up being hundreds (or, in some cases, thousands) of lines long, leading to a potential maintenance headache.
EXPLICIT mode, the query author is responsible for making sure the XML is well formed and that the rowset generated behind the scenes corresponds to a very particular format.
FOR XML PATH statement renders
FOR XML EXPLICIT obsolete except when you need to output column values as
CDATA. This section therefore briefly covers the required query structure for and provides an example of this particular ...