org.mmbase.util.transformers
Class Xml

java.lang.Object
  extended byorg.mmbase.util.transformers.StringTransformer
      extended byorg.mmbase.util.transformers.ConfigurableStringTransformer
          extended byorg.mmbase.util.transformers.Xml
All Implemented Interfaces:
CharTransformer, ConfigurableTransformer, Transformer

public class Xml
extends ConfigurableStringTransformer
implements CharTransformer

Transformations related to escaping in XML.

Version:
$Id: Xml.java,v 1.11 2004/01/05 17:40:52 michiel Exp $
Author:
Michiel Meeuwissen, Kees Jongenburger

Field Summary
static int ESCAPE
           
static int ESCAPE_ATTRIBUTE
           
static int ESCAPE_ATTRIBUTE_DOUBLE
           
static int ESCAPE_ATTRIBUTE_HTML
           
static int ESCAPE_ATTRIBUTE_SINGLE
           
 
Fields inherited from class org.mmbase.util.transformers.ConfigurableStringTransformer
to
 
Constructor Summary
Xml()
           
 
Method Summary
 java.lang.String getEncoding()
          Returns the encoding that is currently active
 java.lang.String transform(java.lang.String r)
           
 java.lang.String transformBack(java.lang.String r)
           
 java.util.Map transformers()
          Used when registering this class as a possible Transformer
static java.lang.String XMLAttributeEscape(java.lang.String att)
           
static java.lang.String XMLAttributeEscape(java.lang.String att, char quot)
          Attributes of XML tags cannot contain quotes.
static java.lang.String XMLEscape(java.lang.String xml)
          Utility class for escaping and unescaping (XML)data
static java.lang.String XMLUnescape(java.lang.String data)
          Utility class for escaping and unescaping (XML)data
 
Methods inherited from class org.mmbase.util.transformers.ConfigurableStringTransformer
configure, toString
 
Methods inherited from class org.mmbase.util.transformers.StringTransformer
transform, transform, transformBack, transformBack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.util.transformers.CharTransformer
transform, transform, transformBack, transformBack
 
Methods inherited from interface org.mmbase.util.transformers.Transformer
toString
 

Field Detail

ESCAPE

public static final int ESCAPE
See Also:
Constant Field Values

ESCAPE_ATTRIBUTE

public static final int ESCAPE_ATTRIBUTE
See Also:
Constant Field Values

ESCAPE_ATTRIBUTE_DOUBLE

public static final int ESCAPE_ATTRIBUTE_DOUBLE
See Also:
Constant Field Values

ESCAPE_ATTRIBUTE_SINGLE

public static final int ESCAPE_ATTRIBUTE_SINGLE
See Also:
Constant Field Values

ESCAPE_ATTRIBUTE_HTML

public static final int ESCAPE_ATTRIBUTE_HTML
See Also:
Constant Field Values
Constructor Detail

Xml

public Xml()
Method Detail

transformers

public java.util.Map transformers()
Used when registering this class as a possible Transformer

Specified by:
transformers in interface ConfigurableTransformer
Specified by:
transformers in class ConfigurableStringTransformer

XMLAttributeEscape

public static java.lang.String XMLAttributeEscape(java.lang.String att,
                                                  char quot)
Attributes of XML tags cannot contain quotes.


XMLAttributeEscape

public static java.lang.String XMLAttributeEscape(java.lang.String att)

XMLEscape

public static java.lang.String XMLEscape(java.lang.String xml)
Utility class for escaping and unescaping (XML)data

Parameters:
xml - the xml to encode
Returns:
the encoded xml data
  • & is replaced by &
  • " is replaced by "
  • < is replaced by &lt;
  • > is replaced by &gt;

XMLUnescape

public static java.lang.String XMLUnescape(java.lang.String data)
Utility class for escaping and unescaping (XML)data

Parameters:
data - the data to decode to (html/xml) where
  • & was replaced by &amp;
  • " was replaced by &quot;
  • < was replaced by &lt;
  • > was replaced by &gt;
Returns:
the decoded xml data

transform

public java.lang.String transform(java.lang.String r)
Specified by:
transform in interface CharTransformer
Specified by:
transform in class StringTransformer

transformBack

public java.lang.String transformBack(java.lang.String r)
Specified by:
transformBack in interface CharTransformer
Overrides:
transformBack in class StringTransformer

getEncoding

public java.lang.String getEncoding()
Description copied from interface: ConfigurableTransformer
Returns the encoding that is currently active

Specified by:
getEncoding in interface ConfigurableTransformer
Specified by:
getEncoding in class ConfigurableStringTransformer


MMBase build 1.7.1.20041002