Writing XML Files

Consider the following encoding requirements when you write XML files:

Encoding Special Characters

Some characters and symbols must be encoded for a proper XML syntax:

Description Character XML representation
Less Than < &lt;
Greater Than > &gt;
Quote " &quot;
Ampersand & &amp;
Apostrophe ' &apos;

Encoding Binary Data

Binary data must be encoded in hexadecimal notation:

Description XML representation
CR (carriage return) &#x0D;
LF (line feed) &#x0A;
NULL-byte &#x00;
Any byte hex code &#x<byte hex code>;