/** * Checks all characters of the given String to determine if they syntactically match the * production of an NMToken. * * @param str the String to check * @return true if the given String follows the Syntax of an NMToken */ public static boolean isNMToken(final String str) { if (str == null) { return false; } char[] chars = str.toCharArray(); for (int i = 0; i < chars.length; i++) { char ch = chars[i]; if (isLetter(ch) || isDigit(ch) || isExtender(ch) || isCombiningChar(ch)) { continue; } switch (ch) { case '.': case '-': case '_': case ':': break; default: return false; } } return true; } // -- isNMToken
/** * Checks all characters of the given String to determine if they * syntactically match the production of an NMToken. * * @param str * the String to check * @return true if the given String follows the Syntax of an NMToken */ public static boolean isNMToken(final String str) { if (str == null) { return false; } char[] chars = str.toCharArray(); for (int i = 0; i < chars.length; i++) { char ch = chars[i]; if (isLetter(ch) || isDigit(ch) || isExtender(ch) || isCombiningChar(ch)) { continue; } switch (ch) { case '.': case '-': case '_': case ':': break; default: return false; } } return true; } // -- isNMToken
/** * Checks the the given character to determine if it is a valid NCNameChar as defined by the W3C * XML Namespaces recommendation. * * @param ch the char to check * @return true if the given char is an NCNameChar */ public static boolean isNCNameChar(final char ch) { if (isLetter(ch) || isDigit(ch)) { return true; } if (isExtender(ch) || isCombiningChar(ch)) { return true; } switch (ch) { case '.': case '-': case '_': return true; default: return false; } } // -- isNCNameChar
/** * Checks the the given character to determine if it is a valid NCNameChar * as defined by the W3C XML Namespaces recommendation. * * @param ch * the char to check * @return true if the given char is an NCNameChar */ public static boolean isNCNameChar(final char ch) { if (isLetter(ch) || isDigit(ch)) { return true; } if (isExtender(ch) || isCombiningChar(ch)) { return true; } switch (ch) { case '.': case '-': case '_': return true; default: return false; } } // -- isNCNameChar