Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.om
Class NameChecker

    java.lang.Object
      net.sf.saxon.om.NameChecker

Direct Known Subclasses:
  Name10Checker, Name11Checker

public abstract class NameChecker
extends java.lang.Object

A NameChecker performs validation and analysis of XML names. There are two implementations of this interface, one for XML 1.0 names and one for XML 1.1 names. The class also handles validation of characters against the XML 1.0 or XML 1.1 rules.

Constructor Summary
`NameChecker()`

Method Summary
`static java.lang.String` | `getPrefix(java.lang.String qname)` Extract the prefix from a QName.
`java.lang.String[]` | `getQNameParts(java.lang.CharSequence qname)` Validate a QName, and return the prefix and local name.
`abstract java.lang.String` | `getXMLVersion()` Return the XML version supported by this NameChecker
`boolean` | `isQName(java.lang.String name)` Validate whether a given string constitutes a valid QName, as defined in XML Namespaces.
`abstract boolean` | `isValidChar(int ch)` Test whether a character is a valid XML character
`abstract boolean` | `isValidNCName(java.lang.String name)` Validate whether a given string constitutes a valid NCName, as defined in XML Namespaces.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NameChecker

    public NameChecker()

Method Detail

### isQName

    public final boolean isQName(java.lang.String name)

  Validate whether a given string constitutes a valid QName, as defined in XML Namespaces. Note that this does not test whether the prefix is actually declared.

  Parameters:
    `name` - the name to be tested
  Returns:
    true if the name is a lexically-valid QName

### isValidNCName

    public abstract boolean isValidNCName(java.lang.String name)

  Validate whether a given string constitutes a valid NCName, as defined in XML Namespaces.

  Parameters:
    `name` - the name to be tested
  Returns:
    true if the name is a lexically-valid QName

### getPrefix

    public static final java.lang.String getPrefix(java.lang.String qname)

  Extract the prefix from a QName. Note, the QName is assumed to be valid.

  Parameters:
    `qname` - The lexical QName whose prefix is required
  Returns:
    the prefix, that is the part before the colon. Returns an empty string if there is no prefix

### getQNameParts

    public final java.lang.String[] getQNameParts(java.lang.CharSequence qname)
                                           throws QNameException

  Validate a QName, and return the prefix and local name.

  Parameters:
    `qname` - the lexical QName whose parts are required
  Returns:
    an array of two strings, the prefix and the local name. The first item is a zero-length string if there is no prefix.
  Throws:
    `QNameException` - if not a valid QName.

### isValidChar

    public abstract boolean isValidChar(int ch)

  Test whether a character is a valid XML character

  Parameters:
    `ch` - the character to be tested
  Returns:
    true if this is a valid character in the selected version of XML

### getXMLVersion

    public abstract java.lang.String getXMLVersion()

  Return the XML version supported by this NameChecker

  Returns:
    "1.0" or "1.1" as a string

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD