Contents | Package | Class | Tree | Deprecated | Index | Help | XML for Java
PREV | NEXT | SHOW LISTS | HIDE LISTS |

# Class com.ibm.xml.parser.Util

    java.lang.Object
        |
        +----com.ibm.xml.parser.Util

public class Util
extends java.lang.Object

Util is a collection of XML4J utility routines which check the conformance of various XML-defined values (XML name, language ID, encoding ID), and which provide services for converting strings to XML format.

Version:
  1.1

Constructor Summary
Util()

Method Summary
static java.lang.String | backReference(java.lang.String string, java.lang.String enc) Returns the specified string after substituting `&, <, >, ', "`, and UTF-16 surrogates for the set of general entities (`&amp;, &lt;, &gt;, &apos;, &quot;`) and numeric character references (`&#...`) respectively.
static java.lang.String | backReferenceForEntity(java.lang.String string, java.lang.String enc) Returns the specified string after substituting `", ', %, CR, LF, TAB`,and UTF-16 surrogates for `&#x26;, &#x22;, &#x27;, &#x25;, &#x0D;, &#x0A, &#x09, and &#x...;` respectively.
static boolean | checkAllSpace(java.lang.String string) Returns whether the specified string consists of only XML whitespace.
static boolean | checkEncoding(java.lang.String enc) Returns whether the specified enc conforms to an encoding name in XML 1.0.
static boolean | checkLanguageID(java.lang.String languageID) Returns whether the specified languageID conforms to a language ID in XML 1.0.
static boolean | checkName(java.lang.String name) Returns whether the specified name conforms to `Name` in XML 1.0.
static boolean | checkNmtoken(java.lang.String nmtoken) Returns whether the specified nmtoken conforms to `Nmtoken` in XML 1.0.
static boolean | checkVersionNum(java.lang.String versionNum) Returns whether the specified versionNum conforms to a version numner in XML 1.0.
static int | getInvalidURIChar(java.lang.String uri) Returns the index of the first invalid character in the specified uri.

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

Constructor Detail

### Util

    public Util()

Method Detail

### checkName

    public static boolean checkName(java.lang.String name)

  Returns whether the specified name conforms to `Name` in XML 1.0. Refer to the definition of `Name` for details.
  Parameters:
    `name` - Name to be checked as a valid XML name.
  Returns:
    =true if name complies with XML spec; otherwise =false.

### checkNmtoken

    public static boolean checkNmtoken(java.lang.String nmtoken)

  Returns whether the specified nmtoken conforms to `Nmtoken` in XML 1.0. Refer to the definition of `Nmtoken` for details.
  Parameters:
    `nmtoken` - NMToken to be checked as a valid XML NMToken.
  Returns:
    =true if name complies with XML spec; otherwise =false.

### checkAllSpace

    public static boolean checkAllSpace(java.lang.String string)

  Returns whether the specified string consists of only XML whitespace. Refer to the definition of `S` for details.
  Parameters:
    `string` - String to be checked if it constains all XML whitespace.
  Returns:
    =true if name is all XML whitespace; otherwise =false.

### checkEncoding

    public static boolean checkEncoding(java.lang.String enc)

  Returns whether the specified enc conforms to an encoding name in XML 1.0. Refer to the definition of `EncName` for details.

  Note that just because enc may be a valid encoding name does not imply the encoding is supported by XML4J.

  Parameters:
    `enc` - Name to be checked as a valid encoding name.
  Returns:
    =true if name complies with XML spec; otherwise =false.
  See Also:
    setEncoding

### checkLanguageID

    public static boolean checkLanguageID(java.lang.String languageID)

  Returns whether the specified languageID conforms to a language ID in XML 1.0. Refer to XML 1.0 / 2.12 Language Identification for details.
  Parameters:
    `languageID` - ID to be checked as a valid language ID.
  Returns:
    =true if ID complies with XML spec; otherwise =false.
  See Also:
    getLanguage, getLanguage, getLanguage

### checkVersionNum

    public static boolean checkVersionNum(java.lang.String versionNum)

  Returns whether the specified versionNum conforms to a version numner in XML 1.0. Refer to the definition of `VersionNum` for details.
  Parameters:
    `versionNum` - Number to be checked as a valid version number.
  Returns:
    =true if number complies with XML spec; otherwise =false.

### getInvalidURIChar

    public static int getInvalidURIChar(java.lang.String uri)

  Returns the index of the first invalid character in the specified uri. Refer to RFC1738 and RFC1808 for details.
  Parameters:
    `uri` - URI to check for validity against RFC1738 and RFC1808.
  Returns:
    0-based index of first invalid URI character, or `-1` if URI is valid.

### backReference

    public static java.lang.String backReference(java.lang.String string,
                                       java.lang.String enc)

  Returns the specified string after substituting `&, <, >, ', "`, and UTF-16 surrogates for the set of general entities (`&amp;, &lt;, &gt;, &apos;, &quot;`) and numeric character references (`&#...`) respectively.

  This routine can be used by all DOM and XML4J objects EXCEPT Entity in order to represent their contents in XML format.

  Parameters:
    `string` - String to convert to XML format.
    `enc` - CURRENTLY NOT IMPLEMENTED.
  Returns:
    XML-formatted string.
  See Also:
    backReferenceForEntity

### backReferenceForEntity

    public static java.lang.String backReferenceForEntity(java.lang.String string,
                                                java.lang.String enc)

  Returns the specified string after substituting `", ', %, CR, LF, TAB`,and UTF-16 surrogates for `&#x26;, &#x22;, &#x27;, &#x25;, &#x0D;, &#x0A, &#x09, and &#x...;` respectively.

  This routine can be used by Entity objects in order to represent their contents in XML format.

  Parameters:
    `string` - String to convert to XML format.
    `enc` - CURRENTLY NOT IMPLEMENTED.
  Returns:
    XML-formatted string.
  See Also:
    backReference

Contents | Package | Class | Tree | Deprecated | Index | Help |
PREV | NEXT | SHOW LISTS | HIDE LISTS |