/** * validate the value against the xsd definition * <p/> * NCName ::= (Letter | '_') (NCNameChar)* NCNameChar ::= Letter | Digit | '.' | '-' | '_' | * CombiningChar | Extender */ public static boolean isValid(String stValue) { int scan; boolean bValid = true; for (scan = 0; scan < stValue.length(); scan++) { if (scan == 0) bValid = XMLChar.isNCNameStart(stValue.charAt(scan)); else bValid = XMLChar.isNCName(stValue.charAt(scan)); if (!bValid) break; } return bValid; } }
/** * validate the value against the xsd definition * <p/> * NCName ::= (Letter | '_') (NCNameChar)* NCNameChar ::= Letter | Digit | '.' | '-' | '_' | * CombiningChar | Extender */ public static boolean isValid(String stValue) { int scan; boolean bValid = true; for (scan = 0; scan < stValue.length(); scan++) { if (scan == 0) bValid = XMLChar.isNCNameStart(stValue.charAt(scan)); else bValid = XMLChar.isNCName(stValue.charAt(scan)); if (!bValid) break; } return bValid; } }
/** * Check to see if a string is a valid NCName according to [4] * from the XML Namespaces 1.0 Recommendation * * @param ncName string to check * @return true if name is a valid NCName */ public static boolean isValidNCName(String ncName) { if (ncName.length() == 0) { return false; } char ch = ncName.charAt(0); if (!isNCNameStart(ch)) { return false; } for (int i = 1; i < ncName.length(); i++) { ch = ncName.charAt(i); if (!isNCName(ch)) { return false; } } return true; } // isValidNCName(String):boolean
/** * Check to see if a string is a valid NCName according to [4] * from the XML Namespaces 1.0 Recommendation * * @param ncName string to check * @return true if name is a valid NCName */ public static boolean isValidNCName(String ncName) { if (ncName.length() == 0) { return false; } char ch = ncName.charAt(0); if (!isNCNameStart(ch)) { return false; } for (int i = 1; i < ncName.length(); i++) { ch = ncName.charAt(i); if (!isNCName(ch)) { return false; } } return true; } // isValidNCName(String):boolean