DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.input
Class ReferenceResolver

java.lang.Object
  extended by org.dlese.dpc.schemedit.input.ReferenceResolver

public class ReferenceResolver
extends Object

Resolves numeric and character references (e.g, or δ) into their unicode representations.

Author:
ostwald

$Id $


Nested Class Summary
 class ReferenceResolver.ResolverResults
          Returned by ReferenceResolver.resolve storing the resolved input string and a list of errors describing references that could not be resolved.
 
Field Summary
static Map charEntityMap
          Description of the Field
 
Constructor Summary
ReferenceResolver()
          Constructor for the ReferenceResolver object
 
Method Summary
static Map getCharEntityMap()
          Gets a mapping from HTML 4 character entity references to their numeric equivalents (see http://www.w3.org/TR/REC-html40/sgml/entities.html#h-24.3.1)
static void main(String[] args)
          The main program for the ReferenceResolver class
 ReferenceResolver.ResolverResults resolve(String in)
          Resolves a string by replacing numeric (e.g., ©) and character references (e.g., δ) with thier equivalent unicode representation.
static String unescapeAmpersands(String in)
          Escape all escaped ampersands (&) as a preprocessing step in resolution of entity references.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

charEntityMap

public static Map charEntityMap
Description of the Field

Constructor Detail

ReferenceResolver

public ReferenceResolver()
Constructor for the ReferenceResolver object

Method Detail

resolve

public ReferenceResolver.ResolverResults resolve(String in)
Resolves a string by replacing numeric (e.g., ©) and character references (e.g., δ) with thier equivalent unicode representation. Returns results as a ResolverResult instance, which contains the resolved string, as well as errors encountered, if any

Parameters:
in - Description of the Parameter
Returns:
Description of the Return Value

unescapeAmpersands

public static String unescapeAmpersands(String in)
Escape all escaped ampersands (&) as a preprocessing step in resolution of entity references. For example, "©" and "©" both become "©". Even "&" is contracted.

Parameters:
in - String to be processed
Returns:
processed string

main

public static void main(String[] args)
                 throws Exception
The main program for the ReferenceResolver class

Parameters:
args - The command line arguments
Throws:
Exception - Description of the Exception

getCharEntityMap

public static Map getCharEntityMap()
Gets a mapping from HTML 4 character entity references to their numeric equivalents (see http://www.w3.org/TR/REC-html40/sgml/entities.html#h-24.3.1)

Returns:
The charEntityMap value

DLESE Tools
v1.6.0