Filtering illegal XML characters in Java

Posted by GrzegorzOledzki on Stack Overflow See other posts from Stack Overflow or by GrzegorzOledzki
Published on 2010-05-24T12:54:17Z Indexed on 2010/05/24 13:11 UTC
Read the original article Hit count: 227

Filed under:
|
|

XML spec defines a subset of Unicode characters which are allowed in XML documents: http://www.w3.org/TR/REC-xml/#charsets.

How do I filter out these characters from a String in Java?

simple test case:

  Assert.equals("", filterIllegalXML(""+Character.valueOf((char) 2)))

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml