You can convert Mathematica expressions into XML strings using the ExportString function. This function has the following syntax.
For exporting as XML, the relevant formats are "XML", "NotebookML", "ExpressionML", "MathML", and "SVG".
This command produces a SymbolicXML expression.
If the SymbolicXML expression is supplied as the first argument of ExportString, the resulting output is ordinary XML.
If the first argument is some other type of expression, the output is in the form of ExpressionML.
You can control various details of the export process using the ConversionOptions feature of the ExportString function. For more information, see XML Export Conversion Options.