Returning query results as XML

This example demonstrates the way to return query results as an XML document.

Syntax Notes

 * RAW('Event')
 * Specifies that each result row will be in a "&lt;Event&gt;" element.


 * ROOT('Events')
 * Specifies that the root node of the XML document will be called "Events".
 * For ease of deserialization into a generic collection of Event objects, this would be better named "ArrayOfEvent".


 * TYPE
 * Tells SQL to return the results using SQL's XML data type.


 * ELEMENTS
 * Specifies that each field in the row will have its own element tag, instead of being rendered as an attribute.

Syntax Notes
...