Class ReferenceResolver

java.lang.Object
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

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    Returned by ReferenceResolver.resolve storing the resolved input string and a list of errors describing references that could not be resolved.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static Map
    Description of the Field
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the ReferenceResolver object
  • Method Summary

    Modifier and Type
    Method
    Description
    static Map
    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
    Resolves a string by replacing numeric (e.g., ©) and character references (e.g., δ) with thier equivalent unicode representation.
    static String
    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 Details

    • charEntityMap

      public static Map charEntityMap
      Description of the Field
  • Constructor Details

    • ReferenceResolver

      public ReferenceResolver()
      Constructor for the ReferenceResolver object
  • Method Details

    • resolve

      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 "invalid input: '&#169'". 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