org.apache.crimson.util
Class XmlNames

java.lang.Object
  extended byorg.apache.crimson.util.XmlNames

public class XmlNames
extends Object

This class contains static methods used to determine whether identifiers may appear in certain roles in XML documents. Such methods are used both to parse and to create such documents.

Author:
David Brownell

Field Summary
static String SPEC_XML_URI
          Useful strings from the DOM Level 2 Spec
static String SPEC_XMLNS_URI
           
 
Constructor Summary
private XmlNames()
           
 
Method Summary
static String getLocalPart(String qualifiedName)
          Return the LocalPart of qualifiedName.
static String getPrefix(String qualifiedName)
          Return the Prefix of qualifiedName.
static boolean isName(String value)
          Returns true if the value is a legal XML name.
static boolean isNCNmtoken(String token)
          This method returns true if the identifier is a "name token" as defined by the XML Namespaces proposed recommendation.
static boolean isNmtoken(String token)
          This method returns true if the identifier is a "name token" as defined in the XML specification.
static boolean isQualifiedName(String value)
          Returns true if the value is a legal "qualified" XML name, as defined in the XML Namespaces proposed recommendation.
static boolean isUnqualifiedName(String value)
          Returns true if the value is a legal "unqualified" XML name, as defined in the XML Namespaces proposed recommendation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPEC_XML_URI

public static final String SPEC_XML_URI
Useful strings from the DOM Level 2 Spec

See Also:
Constant Field Values

SPEC_XMLNS_URI

public static final String SPEC_XMLNS_URI
See Also:
Constant Field Values
Constructor Detail

XmlNames

private XmlNames()
Method Detail

isName

public static boolean isName(String value)
Returns true if the value is a legal XML name.

Parameters:
value - the string being tested

isUnqualifiedName

public static boolean isUnqualifiedName(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.

Parameters:
value - the string being tested

isQualifiedName

public static boolean isQualifiedName(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.)

Parameters:
value - the string being tested

isNmtoken

public static boolean isNmtoken(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.

Parameters:
token - the string being tested

isNCNmtoken

public static boolean isNCNmtoken(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.

Parameters:
token - the string being tested
See Also:
isNmtoken(java.lang.String)

getPrefix

public static String getPrefix(String qualifiedName)
Return the Prefix of qualifiedName. Does not check that Prefix is a valid NCName.

Parameters:
qualifiedName - name to find the Prefix of
Returns:
prefix or null if it has none

getLocalPart

public static String getLocalPart(String qualifiedName)
Return the LocalPart of qualifiedName. Does not check that Prefix is a valid NCName.

Parameters:
qualifiedName - name to find the LocalPart of
Returns:
LocalPart or null if it has none