ASA SQL User's Guide
Using XML in the Database
Obtaining query results as XML
Using the FOR XML clause to retrieve query results as XML
Adaptive Server Anywhere uses the following rules for encoding names that are not legal XML names (for example, column names that include spaces):
Unicode characters that are not valid XML name characters are escaped as _xHHHH_, where HHHH stands for the four digit hexadecimal codepoint for the character. Characters whose Unicode codepoint value cannot be specified in 16 bits are encoded.
For example, the following query contains a column name with a space:
SELECT emp_id AS "employee id" FROM employee FOR XML RAW
and returns the following result:
<row employee_x0020_id="102"/> <row employee_x0020_id="105"/> <row employee_x0020_id="129"/> <row employee_x0020_id="148"/> ...
Non-Unicode characters are encoded as _xHHHHHHHH_, where HHHHHHHH stands for stands for the eight digit hexadecimal codepoint for the character.
Underscores (_) are escaped if they are followed by the character x.
Colons (:) are not escaped so that namespace declarations and qualified element and attribute names can be generated using a FOR XML query.
For information about the syntax of the FOR XML clause, see SELECT statement.
TipWhen executing queries that contain a FOR XML clause in Interactive SQL, you may wish to increase the column length by setting the TRUNCATION_LENGTH option.For information about setting the truncation length, see TRUNCATION_LENGTH option [ISQL] and Options dialog: Results tab. |