com.ssx.xml.output
Class XmlNameUtil

java.lang.Object
  extended bycom.ssx.xml.output.XmlNameUtil

public class XmlNameUtil
extends Object

A utility class for dealing with XML characters NOTE: This class is not fully implemented. It will not give the correct results for any of the more esoteric unicode characters.


Field Summary
static int BASE_CHAR
           
static int COMBINING_CHAR
           
static int DIGIT
           
static int EXTENDER
           
static int IDEOGRAPHIC
           
static int INVALID
          Not a valid XML character
static int LETTER
           
 
Method Summary
static int getCharType(char ch)
          Return an integer representing the XML character class this character belongs to according the the W3C XML 1.0 specification.
static String getEntityRef(char ch)
          Return the entity reference for the given char as defined by the W3C XML 1.0 specification.
static boolean isBaseChar(char ch)
          Is the given char a valid BASE_CHAR as defined by the W3C XML 1.0 specification.
static boolean isCombiningChar(char ch)
          Is the given char a valid COMBINING_CHAR as defined by the W3C XML 1.0 specification.
static boolean isDigit(char ch)
          Is the given char a valid DIGIT as defined by the W3C XML 1.0 specification.
static boolean isExtender(char ch)
          Is the given char a valid EXTENDER as defined by the W3C XML 1.0 specification.
static boolean isIdeographic(char ch)
          Is the given char a valid IDEOGRAPHIC as defined by the W3C XML 1.0 specification.
static boolean isLetter(char ch)
          Is the given char a valid LETTER as defined by the W3C XML 1.0 specification.
static void validateName(String name)
          Is the given char a valid name as defined by the W3C XML 1.0 specification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID

public static final int INVALID
Not a valid XML character

See Also:
Constant Field Values

LETTER

public static final int LETTER
See Also:
Constant Field Values

BASE_CHAR

public static final int BASE_CHAR
See Also:
Constant Field Values

IDEOGRAPHIC

public static final int IDEOGRAPHIC
See Also:
Constant Field Values

COMBINING_CHAR

public static final int COMBINING_CHAR
See Also:
Constant Field Values

DIGIT

public static final int DIGIT
See Also:
Constant Field Values

EXTENDER

public static final int EXTENDER
See Also:
Constant Field Values
Method Detail

getCharType

public static int getCharType(char ch)
Return an integer representing the XML character class this character belongs to according the the W3C XML 1.0 specification.

Parameters:
ch - The character to get the type of
Returns:
An int indicating the type of ch as defined by the XML 1.0 Spec.

isLetter

public static boolean isLetter(char ch)
Is the given char a valid LETTER as defined by the W3C XML 1.0 specification.

Parameters:
ch - The character to test
Returns:
True if ch is an XML letter

isBaseChar

public static boolean isBaseChar(char ch)
Is the given char a valid BASE_CHAR as defined by the W3C XML 1.0 specification.

Parameters:
ch - The character to test
Returns:
True if ch is an XML base char

isIdeographic

public static boolean isIdeographic(char ch)
Is the given char a valid IDEOGRAPHIC as defined by the W3C XML 1.0 specification.

Parameters:
ch - The character to test
Returns:
True if ch is an XML ideographic

isCombiningChar

public static boolean isCombiningChar(char ch)
Is the given char a valid COMBINING_CHAR as defined by the W3C XML 1.0 specification.

Parameters:
ch - The character to test
Returns:
True if ch is an XML combining char

isDigit

public static boolean isDigit(char ch)
Is the given char a valid DIGIT as defined by the W3C XML 1.0 specification.

Parameters:
ch - The character to test
Returns:
True if ch is an XML digit

isExtender

public static boolean isExtender(char ch)
Is the given char a valid EXTENDER as defined by the W3C XML 1.0 specification.

Parameters:
ch - The character to test
Returns:
True if ch is an XML extender char

validateName

public static void validateName(String name)
Is the given char a valid name as defined by the W3C XML 1.0 specification. Throws an XmlOutputException if name is not a valid XML name

Parameters:
name - The XML name to test

getEntityRef

public static String getEntityRef(char ch)
Return the entity reference for the given char as defined by the W3C XML 1.0 specification.

Parameters:
ch - The character to translate into an entity ref
Returns:
The entity reference equivalent to ch