Java examples for XML:XML String
Detect bad xml 1.0 characters
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { char c = 'a'; System.out.println(isBadXmlCharacter(c)); }/*from w w w . j a v a2 s . c o m*/ /** * Detect bad xml 1.0 characters * * @param c to detect * @return true if specified character valid, false otherwise */ public static boolean isBadXmlCharacter(char c) { boolean cDataCharacter = c < '\u0020' && c != '\t' && c != '\r' && c != '\n'; cDataCharacter |= (c >= '\uD800' && c < '\uE000'); cDataCharacter |= (c == '\uFFFE' || c == '\uFFFF'); return cDataCharacter; } }