* by including them in the [[XQuery_3.0#Serialization|prolog of the XQuery expression]],
* by specifying them in the XQuery functions [[File_FunctionsFile_Module#file:write|file:write()]] or [[XQuery_3.0#Functions|fn:serialize()]],
* by using the <code>-s</code> flag of the BaseX [[Startup_Options#BaseX|command-line]] clients,
* by setting the [[Options#SERIALIZER|SERIALIZER]] option before running a query,
| Specifies the serialization method:
* <code>xml</code>, <code>xhtml</code>, <code>html</code>, and <code>text</code> are taken from the official specification.
* <code>json</code> and <code>jsonml</code> are specific to BaseX and can be used to output XML nodes in the JSON format (see the [[JSON FunctionsModule]] for more details). Added with {{Version|7.0}}
* <code>raw</code> is BaseX-specific as well. Binary data is output as raw data, all other items are returned in their string representation, and no indentation and entity coding takes place. Added with {{Version|7.0}}
| <code>xml</code>, <code>xhtml</code>, <code>html</code>, <code>text</code>, <code>json</code>, <code>jsonml</code>, <code>raw</code>