When using the FOR XML clause in a query in SQL Server, we can generate an XML document either with or without an inline schema.
To generate it with an inline XSD schema simply include the XMLSCHEMA argument. We can alternatively include the namespace if we want to specify a particular namespace.
At the time of writing, the XMLSCHEMA argument is only available when in either AUTO or RAW mode.