public static boolean isXMLValidCharacter(char character) {
        // Order the tests in such a sequence that the most probable
        // conditions are tested first.
        return character >= 0x20 && character <= 0xD7FF || character == 0x9
                || character == 0xA || character == 0xD || character >= 0xE000
                && character <= 0xFFFD || character >= 0x10000
                && character <= 0x10FFFF;
    }