org.apache.ecs
Class CharacterFilter

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--org.apache.ecs.CharacterFilter

public class CharacterFilter
extends java.util.Hashtable
implements Filter

This class creates a Filter object. The default characters filtered are:
" ' & < >

For example:


Filter filter = new CharacterFilter();
filter.addAttribute("$","dollar");
filter.addAttribute("#",Entities.POUND);

P p = new P();
p.setFilter(filter);

Document doc = new Document();
doc.getBody().addElement(p);
The filter is applied when the addElement() method is called.

Version:
$Id: CharacterFilter.java,v 1.2 1999/04/26 17:17:00 stephan Exp $
Author:
Stephan Nagy, Jon S. Stevens
See Also:
Serialized Form

Fields inherited from class java.util.Hashtable
count, ENTRIES, entrySet, KEYS, keySet, loadFactor, modCount, serialVersionUID, table, threshold, values, VALUES
 
Constructor Summary
CharacterFilter()
           
 
Method Summary
(package private)  void ()
          Private initializer.
 Filter addAttribute(java.lang.String name, java.lang.Object attribute)
           
 boolean hasAttribute(java.lang.String key)
           
 java.lang.String process(java.lang.String to_process)
           
 Filter removeAttribute(java.lang.String name)
           
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, readObject, rehash, remove, size, toString, values, writeObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

CharacterFilter

public CharacterFilter()
Method Detail

void ()
Private initializer. " ' & < > are the default filters.
Overrides:
in class java.lang.Object

addAttribute

public Filter addAttribute(java.lang.String name,
                           java.lang.Object attribute)
Specified by:
addAttribute in interface Filter

removeAttribute

public Filter removeAttribute(java.lang.String name)
Specified by:
removeAttribute in interface Filter

hasAttribute

public boolean hasAttribute(java.lang.String key)
Specified by:
hasAttribute in interface Filter

process

public java.lang.String process(java.lang.String to_process)
Specified by:
process in interface Filter