When you store an XML document in a DB2® database and then retrieve that copy from the database, the retrieved document might not be exactly the same as the original document. This behavior is defined by the XML and SQL/XML standard and matches that of the Xerces open source XML parser.
This process causes line feed (U+000A) characters in attributes to be replaced with space characters (U+0020).
With implicit serialization, for CLI and embedded SQL applications, the DB2 database server adds an XML declaration, with the appropriate encoding specification, to the data. For Java and .NET applications, the DB2 database server does not add an XML declaration, but if you retrieve the data into a DB2Xml object and use certain methods to retrieve the data from that object, the IBM® Data Server Driver for JDBC and SQLJ adds an XML declaration.
If you execute the XMLSERIALIZE function, the DB2 database server adds an XML declaration with an encoding specification for UTF-8 encoding, if you specify the INCLUDING XMLDECLARATION option.
Character | Unicode value | Entity representation |
---|---|---|
AMPERSAND | U+0026 | & |
LESS-THAN SIGN | U+003C | < |
GREATER-THAN SIGN | U+003E | > |
Character | Unicode value | Entity representation |
---|---|---|
CHARACTER TABULATION | U+0009 | 	 |
LINE FEED | U+000A | 
 |
CARRIAGE RETURN | U+000D | 
 |
NEXT LINE | U+0085 | … |
LINE SEPARATOR | U+2028 | 
 |