<p>In my environment here I use Java to serialize the result set to XML.
It happens basically like this:</p>

<pre><code>//foreach column of each row
xmlHandler.startElement(uri, lname, "column", attributes);
String chars = rs.getString(i);
xmlHandler.characters(chars.toCharArray(), 0, chars.length());
xmlHandler.endElement(uri, lname, "column");
</code></pre>

<p>The XML looks like this in Firefox:</p>

<pre><code>&lt;row num="69004"&gt;
    &lt;column num="1"&gt;10069&lt;/column&gt;
    &lt;column num="2"&gt;sd&amp;#26;&lt;/column&gt;
    &lt;column num="3"&gt;FCVolume                      &lt;/column&gt;
&lt;/row&gt;
</code></pre>

<p>But when I parse the XML I get the a</p>

<blockquote>
  <p>org.xml.sax.SAXParseException: Character reference "<strong>&amp;#26</strong>" is an
  invalid XML character.</p>
</blockquote>

<p>My question now is: Which charactes do I have to replace or how do I have to encode my characters, that they will be valid XML?</p>

Extensible Markup Language (XML) 1.0
says:
The ampersand character (&) and the
  left angle bracket (<) must not appear
  in their literal form, except when
  used as markup delimiters, or within a
  comment, a processing instruction, or
  a CDATA section. If they are needed
  elsewhere, they must be escaped using
  either numeric character references or
  the strings "&" and "<"
  respectively. The right angle bracket
  (>) may be represented using the
  string ">", and must, for
  compatibility, be escaped using either
  ">" or a character reference when
  it appears in the string "]]>" in
  content, when that string is not
  marking the end of a CDATA section.
You can skip the encoding if you use CDATA:
```
```
<column num="1"><![CDATA[10069]]></column>
<column num="2"><![CDATA[sd&]]></column>
```
```