title: Filtering illegal XML characters in Java
body: <p>XML spec defines a subset of Unicode characters which are allowed in XML documents:
  <a href="http://www.w3.org/TR/REC-xml/#charsets" rel="noreferrer">http://www.w3.org/TR/REC-xml/#charsets</a>.</p>
  
  <p>How do I filter out these characters from a String in Java?</p>
  
  <p>simple test case:</p>
  
  <pre><code>  Assert.equals("", filterIllegalXML(""+Character.valueOf((char) 2)))
  </code></pre>