© 2004 BEA Systems, Inc.

com.beasys.commerce.util.dom
Class EntityFixer

java.lang.Object
  extended bycom.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. "%" -> "&pect;")
 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

defReplaceEntities

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


entities

protected Hashtable entities
Our character to entity mapping.


instance

protected static EntityFixer instance
The singleton EntityFixer.

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 "&".

fixEntities

public String fixEntities(String in)

getEntityMapping

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


getInstance

public static EntityFixer getInstance()
Get the singleton instance.


removeEntityMapping

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


replace

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

String search and replace method.


© 2004 BEA Systems, Inc.

Copyright © 2004 BEA Systems, Inc. All Rights Reserved