Character values contained in char, varchar, or text columns require additional processing. Character values in SQL data can contain characters with special significance in XML: the quote ("), apostrophe ('), less-than (<), greater-than (>), and ampersand (&) characters. When SQL character values are represented as XML attribute or element values, they must be replaced by the XML entities that represent them: @quot; ', <, >, and &.
The following example shows a SQL character value containing XML markup characters. The character literal in the SQL select command doubles the apostrophe, using the SQL convention governing embedded quotes and apostrophes.
select '<name>"Baker''s"</name>' ---------------------- <name>"Baker's"</name>
The following example shows SQLX mapping of that character value, with the XML markup characters replaced by their XML entity representations:
select '<name>"Baker''s"</name>' for xml ------------------------------------------------- <resultset xmlns:xsi="http://www.w3.org/2001 /XMLSchema-instance"> <row> <C1><name>"Baker's"</name>< /C1> </row> </resultset>