be.SIRAPRISE.client
Class EntityRefs

java.lang.Object
  extended by be.SIRAPRISE.client.EntityRefs

public class EntityRefs
extends java.lang.Object

Class holding a utility method to replace the <>'"& tokens with XML entity refs in XML output

Author:
Erwin Smout

Method Summary
static java.lang.String fromHtml(java.lang.String string, Version htmlVersion)
          Processes the input string and replaces all appearances of entity references that are valid under the htmlVersion specified with their actual codepoint value.
static java.lang.String fromXHtml(java.lang.String string, Version xhtmlVersion)
          Processes the input string and replaces all appearances of entity references that are valid under the htmlVersion specified with their actual codepoint value.
static java.lang.String toXML(java.lang.String string)
          Gets the XML version of the input string, i.e. with all <>'"& characters replaced by their appropriate entity references
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromHtml

public static java.lang.String fromHtml(java.lang.String string,
                                        Version htmlVersion)
Processes the input string and replaces all appearances of entity references that are valid under the htmlVersion specified with their actual codepoint value.

Parameters:
string - The input string to be "sanitized" from &#nnnn and &#xhhhh appearances, as well as any named entity refs valid in the given html Version.
htmlVersion - The version indicating which entity refs table to use
Returns:
The sanitized string

fromXHtml

public static java.lang.String fromXHtml(java.lang.String string,
                                         Version xhtmlVersion)
Processes the input string and replaces all appearances of entity references that are valid under the htmlVersion specified with their actual codepoint value.

Parameters:
string - The input string to be "sanitized" from &#nnnn and &#xhhhh appearances, as well as any named entity refs valid in the given html Version.
xhtmlVersion - The version indicating which entity refs table to use
Returns:
The sanitized string

toXML

public static java.lang.String toXML(java.lang.String string)
Gets the XML version of the input string, i.e. with all <>'"& characters replaced by their appropriate entity references

Parameters:
string - the string to be rendered to valid xml
Returns:
the XML version of the input string, i.e. with all <>'"& characters replaced by their appropriate entity references