BEA Systems, Inc.

com.beasys.commerce.util.dom
Class EntityFixer

java.lang.Object
  |
  +--com.beasys.commerce.util.dom.EntityFixer

public class EntityFixer
extends java.lang.Object

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


Constructor Summary
EntityFixer()
          Constructor.
 
Method Summary
 java.lang.String addEntityMapping(java.lang.String chars, java.lang.String value)
          Add a characters to value mapping (i.e.
 java.lang.String fixEntities(java.lang.String in)
           
 java.lang.String getEntityMapping(java.lang.String chars)
          Retrive the a current entity mapping.
static EntityFixer getInstance()
          Get the singleton instance.
 java.lang.String removeEntityMapping(java.lang.String chars)
          Remove an entity mapping.
static java.lang.String replace(java.lang.String inStr, java.lang.String find, java.lang.String replace)
          String search and replace method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityFixer

public EntityFixer()
Constructor.

This will initialize the entity mapping with the default values.

Method Detail

addEntityMapping

public java.lang.String addEntityMapping(java.lang.String chars,
                                         java.lang.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:
java.lang.IllegalArgumentException - thrown if chars is "&".

removeEntityMapping

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

getEntityMapping

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

fixEntities

public java.lang.String fixEntities(java.lang.String in)

replace

public static java.lang.String replace(java.lang.String inStr,
                                       java.lang.String find,
                                       java.lang.String replace)
String search and replace method.

getInstance

public static EntityFixer getInstance()
Get the singleton instance.

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved