Methods Summary |
---|
public static java.lang.String | getLocalPart(java.lang.String qualifiedName)Return the LocalPart of qualifiedName. Does not check that Prefix is a
valid NCName.
// [6] QName ::= (Prefix ':')? LocalPart
// [8] LocalPart ::= NCName
int index = qualifiedName.indexOf(':");
if (index < 0) {
return qualifiedName;
}
// ':' at end of qualifiedName
if (index == qualifiedName.length() - 1) {
return null;
}
return qualifiedName.substring(index + 1);
|
public static java.lang.String | getPrefix(java.lang.String qualifiedName)Return the Prefix of qualifiedName. Does not check that Prefix is a
valid NCName.
// [6] QName ::= (Prefix ':')? LocalPart
// [7] Prefix ::= NCName
int index = qualifiedName.indexOf(':");
return index <= 0 ? null : qualifiedName.substring(0, index);
|
public static boolean | isNCNmtoken(java.lang.String token)This method returns true if the identifier is a "name token" as
defined by the XML Namespaces proposed recommendation.
These are like XML "name tokens" but they may not contain the
"colon" character.
return isNmtoken (token) && token.indexOf (':") < 0;
|
public static boolean | isName(java.lang.String value)Returns true if the value is a legal XML name.
if (value == null || "".equals(value))
return false;
char c = value.charAt (0);
if (!XmlChars.isLetter (c) && c != '_" && c != ':")
return false;
for (int i = 1; i < value.length (); i++)
if (!XmlChars.isNameChar (value.charAt (i)))
return false;
return true;
|
public static boolean | isNmtoken(java.lang.String token)This method returns true if the identifier is a "name token"
as defined in the XML specification. Like names, these
may only contain "name characters"; however, they do not need
to have letters as their initial characters. Attribute values
defined to be of type NMTOKEN(S) must satisfy this predicate.
int length = token.length ();
for (int i = 0; i < length; i++)
if (!XmlChars.isNameChar (token.charAt (i)))
return false;
return true;
|
public static boolean | isQualifiedName(java.lang.String value)Returns true if the value is a legal "qualified" XML name, as defined
in the XML Namespaces proposed recommendation. Qualified names are
composed of an optional prefix (an unqualified name), followed by a
colon, and a required "local part" (an unqualified name). Prefixes are
declared, and correspond to particular URIs which scope the "local
part" of the name. (This method cannot check whether the prefix of a
name has been declared.)
if (value == null)
return false;
// [6] QName ::= (Prefix ':')? LocalPart
// [7] Prefix ::= NCName
// [8] LocalPart ::= NCName
int first = value.indexOf (':");
// no Prefix, only check LocalPart
if (first <= 0)
return isUnqualifiedName (value);
// Prefix exists, check everything
int last = value.lastIndexOf (':");
if (last != first)
return false;
return isUnqualifiedName (value.substring (0, first))
&& isUnqualifiedName (value.substring (first + 1));
|
public static boolean | isUnqualifiedName(java.lang.String value)Returns true if the value is a legal "unqualified" XML name, as
defined in the XML Namespaces proposed recommendation.
These are normal XML names, except that they may not contain
a "colon" character.
if (value == null || value.length() == 0)
return false;
char c = value.charAt (0);
if (!XmlChars.isLetter (c) && c != '_")
return false;
for (int i = 1; i < value.length (); i++)
if (!XmlChars.isNCNameChar (value.charAt (i)))
return false;
return true;
|