com.beasys.commerce.util.dom
Class EntityFixer

java.lang.Object
  extended by com.beasys.commerce.util.dom.EntityFixer

public class EntityFixer
extends Object

A utility class for replacing standard XML entities with their character values.


Field Summary
protected static String[][] defReplaceEntities
          Default XML/HTML entities that represent special character sequences.
protected  Hashtable entities
          Our character to entity mapping.
protected static EntityFixer instance
          The singleton EntityFixer.
 
Constructor Summary
EntityFixer()
          Constructor.
 
Method Summary
 String addEntityMapping(String chars, String value)
          Add a characters to value mapping (i.e.
 String fixEntities(String in)
           
 String getEntityMapping(String chars)
          Retrive the a current entity mapping.
static EntityFixer getInstance()
          Get the singleton instance.
 String removeEntityMapping(String chars)
          Remove an entity mapping.
static String replace(String inStr, String find, String replace)
          Deprecated Use StringUtils
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected static EntityFixer instance
The singleton EntityFixer.


defReplaceEntities

protected static final String[][] defReplaceEntities
Default XML/HTML entities that represent special character sequences.


entities

protected Hashtable entities
Our character to entity mapping.

Constructor Detail

EntityFixer

public EntityFixer()
Constructor.

This will initialize the entity mapping with the default values.

Method Detail

addEntityMapping

public String addEntityMapping(String chars,
                               String value)
Add a characters to value mapping (i.e. "%" -> "&pect;")

Parameters
chars - the characters ("%").
value - the string to replace chars with ("&pect;").
Returns
the previous value, or null if none.
Throws
IllegalArgumentException - thrown if chars is "&".

removeEntityMapping

public String removeEntityMapping(String chars)
Remove an entity mapping.


getEntityMapping

public String getEntityMapping(String chars)
Retrive the a current entity mapping.


fixEntities

public String fixEntities(String in)

replace

public static String replace(String inStr,
                             String find,
                             String replace)
Deprecated Use StringUtils

String search and replace method.


getInstance

public static EntityFixer getInstance()
Get the singleton instance.



Copyright © 2006 BEA Systems, Inc. All Rights Reserved