I'm producing XML right from PL/SQL in Oracle.
What is the preferred way of ensuring that outputted strings are XML-conformant, with regards to special characters and character encoding ?
Most of the XML file is static, we only need to output data for a few fields.
Example of what I consider bad practice:
DECLARE @s AS NVARCHAR(100)
SELECT @s = 'Test chars = (<>, æøåÆØÅ)'
SELECT '<?xml version="1.0" encoding="UTF-8"?>'
+ '<root><foo>'
+ @s
+ '</foo></root>' AS XML