/** * validate the value against the xsd definition Nmtoken ::= (NameChar)+ NameChar ::= * Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender */ public static boolean isValid(String stValue) { int scan; for (scan = 0; scan < stValue.length(); scan++) { if (!XMLChar.isName(stValue.charAt(scan))) return false; } return true; } }
/** * Returns true if the specified character is invalid. * * @param c The character to check. */ public static boolean isInvalid(int c) { return !isValid(c); } // isInvalid(int):boolean
/** * 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 Name ::= (Letter | '_' | ':') ( * NameChar)* NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | * Extender */ //todo - Fix this public static boolean isValid(String stValue) { int scan; boolean bValid = true; for (scan = 0; scan < stValue.length(); scan++) { if (scan == 0) { bValid = XMLChar.isNameStart(stValue.charAt(scan)); } else { bValid = XMLChar.isName(stValue.charAt(scan)); } if (!bValid) break; } return bValid; } }
private String toValidNCName(String name) { if (name == null || name.isEmpty()) { return name; } int c, i = 0; StringBuilder newName = new StringBuilder(); while (i < name.length() && ((c = name.charAt(i++)) != -1)) { if (!XMLChar.isNCName(c)) { newName.append(Constants.ID_KEY).append(c).append('_'); } else { newName.append((char) c); } } return name.length() == newName.length() ? name : newName.toString(); } }
/** * 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 Name ::= (Letter | '_' | ':') ( * NameChar)* NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | * Extender */ //todo - Fix this public static boolean isValid(String stValue) { int scan; boolean bValid = true; for (scan = 0; scan < stValue.length(); scan++) { if (scan == 0) { bValid = XMLChar.isNameStart(stValue.charAt(scan)); } else { bValid = XMLChar.isName(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 Name according to [5] * in the XML 1.0 Recommendation * * @param name string to check * @return true if name is a valid Name */ public static boolean isValidName(String name) { if (name.length() == 0) { return false; } char ch = name.charAt(0); if (!isNameStart(ch)) { return false; } for (int i = 1; i < name.length(); i++) { ch = name.charAt(i); if (!isName(ch)) { return false; } } return true; } // isValidName(String):boolean
/** * validate the value against the xsd definition Nmtoken ::= (NameChar)+ NameChar ::= * Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender */ public static boolean isValid(String stValue) { int scan; for (scan = 0; scan < stValue.length(); scan++) { if (!XMLChar.isName(stValue.charAt(scan))) return false; } return true; } }
/** * Returns true if the specified character is invalid. * * @param c The character to check. */ public static boolean isInvalid(int c) { return !isValid(c); } // isInvalid(int):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
/** * Check to see if a string is a valid Name according to [5] * in the XML 1.0 Recommendation * * @param name string to check * @return true if name is a valid Name */ public static boolean isValidName(String name) { if (name.length() == 0) { return false; } char ch = name.charAt(0); if (!isNameStart(ch)) { return false; } for (int i = 1; i < name.length(); i++) { ch = name.charAt(i); if (!isName(ch)) { return false; } } return true; } // isValidName(String):boolean
/** * Check to see if a string is a valid Nmtoken according to [7] * in the XML 1.0 Recommendation * * @param nmtoken string to check * @return true if nmtoken is a valid Nmtoken */ public static boolean isValidNmtoken(String nmtoken) { if (nmtoken.length() == 0) { return false; } for (int i = 0; i < nmtoken.length(); i++) { char ch = nmtoken.charAt(i); if (! isName(ch)) { return false; } } return true; } // isValidName(String):boolean
/** * Check to see if a string is a valid Nmtoken according to [7] * in the XML 1.0 Recommendation * * @param nmtoken string to check * @return true if nmtoken is a valid Nmtoken */ public static boolean isValidNmtoken(String nmtoken) { if (nmtoken.length() == 0) { return false; } for (int i = 0; i < nmtoken.length(); i++) { char ch = nmtoken.charAt(i); if (! isName(ch)) { return false; } } return true; } // isValidName(String):boolean