com.mindprod.entities
Class EntifyStrings

java.lang.Object
  extended by com.mindprod.entities.EntifyStrings
Direct Known Subclasses:
Entify

public class EntifyStrings
extends java.lang.Object

Inserts HTML entities such as " into a String replacing the single character equivalents.

Entities are coded inline in a giant case.

Since:
2005
Version:
3.1 2011-02-10 rename methods to entifyHTML and entifyXML
Author:
Roedy Green, Canadian Mind Products
See Also:
DeEntify, DeEntifyStrings, Entify, EntifyStrings, Flatten

Constructor Summary
EntifyStrings()
           
 
Method Summary
static java.lang.String entifyHTML(java.lang.String text)
          Converts text to HTML by quoting dangerous characters.
static java.lang.String entifyXML(java.lang.String text)
          Converts text to XML by quoting dangerous characters.
static java.lang.String toHTMLEntity(char c)
          Converts text to HTML by quoting dangerous characters.; Does not convert space to  
static java.lang.String toXMLEntity(char c)
          Converts text to XML by quoting dangerous characters.; Does not convert space to  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntifyStrings

public EntifyStrings()
Method Detail

entifyHTML

public static java.lang.String entifyHTML(java.lang.String text)
Converts text to HTML by quoting dangerous characters. Text must not already contain entities. e.g. " ==> " < ==> < ordinary text passes unchanged. Does not convert space to  

Parameters:
text - raw text to be processed. Must not be null.
Returns:
translated HTML text, or null if input is null.

entifyXML

public static java.lang.String entifyXML(java.lang.String text)
Converts text to XML by quoting dangerous characters. Text must not already contain entities. e.g. " ==> " < ==> < ordinary text passes unchanged. Does not convert space to  

Parameters:
text - raw text to be processed. Must not be null.
Returns:
translated XML text, or null if input is null.

toHTMLEntity

public static java.lang.String toHTMLEntity(char c)
Converts text to HTML by quoting dangerous characters.; Does not convert space to  

Parameters:
c - raw character.
Returns:
translated HTML text, eg. & -> & x -> x

toXMLEntity

public static java.lang.String toXMLEntity(char c)
Converts text to XML by quoting dangerous characters.; Does not convert space to  

Parameters:
c - raw character.
Returns:
translated HTML text, eg. < -> < x -> x