Special character handling in SQL/XML publishing functions
The SQL/XML publishing functions make substitutions for some special characters when SQL values and identifiers are converted to XML values.
Special character handling for SQL values
Special character | Entity representation |
---|---|
< | < |
> | > |
& | & |
" | " (in attribute values only) |
When you publish SQL values as XML values using the SQL/XML publishing functions, the functions replace those special characters with their predefined entities.
Special character handling for SQL identifiers
When you construct XML values from SQL values, you might need to map an SQL identifier to an XML qualified name, or QName. The set of characters that are allowed in delimited SQL identifiers differs, however, from those that are permitted in a QName. This difference means that some characters that are valid for SQL identifiers are not valid in QNames.
For example, consider the delimited SQL identifier "phone@work". Because the @ character is not a valid character in a QName, the character is escaped, and the QName becomes phone_x0040_work.
This default escape behavior applies only to column names. For SQL identifiers that are provided as the element name in XMLELEMENT, or as alias names in the AS clause of XMLFOREST and XMLATTRIBUTES, there are no escape defaults. You must provide valid QNames in these cases.