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

## org.htmlparser.util
Class CharacterReference

    java.lang.Object
      org.htmlparser.util.CharacterReference

All Implemented Interfaces:
  Cloneable, Ordered, Serializable

public class CharacterReference
extends Object
implements Serializable, Cloneable, Ordered

Structure to hold a character and it's equivalent entity reference kernel. For the character reference &copy; the character would be '©' and the kernel would be "copy", for example.

Character references are described at http://www.w3.org/TR/REC-html40/charset.html#entities Supports the Ordered interface so it's easy to create a list sorted by kernel, to perform binary searches on.

See Also:
  Serialized Form

Field Summary
`protected int` | `mCharacter` The character value as an integer.
`protected String` | `mKernel` This entity reference kernel.

Constructor Summary
`CharacterReference(String kernel, int character)` Construct a `CharacterReference` with the character and kernel given.

Method Summary
`int` | `compare(Object that)` Compare one reference to another.
`int` | `getCharacter()` Get the character needing translation.
`String` | `getKernel()` Get this CharacterReference's kernel.
`String` | `toString()` Visualize this character reference as a string.

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

Field Detail

### mCharacter

    protected int mCharacter

  The character value as an integer.

### mKernel

    protected String mKernel

  This entity reference kernel. The text between the ampersand and the semicolon.

Constructor Detail

### CharacterReference

    public CharacterReference(String kernel,
                              int character)

  Construct a `CharacterReference` with the character and kernel given.

Parameters:
  `kernel` - The kernel in the equivalent character entity reference.
  `character` - The character needing encoding.

Method Detail

### getKernel

    public String getKernel()

  Get this CharacterReference's kernel.

  Returns:
    The kernel in the equivalent character entity reference.

### getCharacter

    public int getCharacter()

  Get the character needing translation.

  Returns:
    The character.

### toString

    public String toString()

  Visualize this character reference as a string.

  Returns:
    A string with the character and kernel.

### compare

    public int compare(Object that)

  Compare one reference to another.

  Specified by:
    `compare` in interface `Ordered`
  Parameters:
    `that` - The object to compare this object against.
  Returns:
    A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the second.
  See Also:
    `Ordered`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| © 2004 Somik Raha Mar 14, 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

HTML Parser is an open source library released under LGPL.