dk.brics.xsugar.xml
Class Escaping

java.lang.Object
  extended by dk.brics.xsugar.xml.Escaping

public class Escaping
extends Object

Methods for escaping/unescaping special XML chars.


Method Summary
static dk.brics.automaton.Automaton escape(dk.brics.automaton.Automaton a)
          Escapes ", <, >, and & in the given automaton.
static String escape(String s)
          Escapes ", <, >, and & in the given string.
static String unescape(String s)
          Unescapes ", <, >, &, and character references in the given string.
static String unescape(String s, int i, int j)
          Unescapes a single ", <, >, &, or character reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

escape

public static dk.brics.automaton.Automaton escape(dk.brics.automaton.Automaton a)
Escapes ", <, >, and & in the given automaton.

Parameters:
a - input automaton
Returns:
automaton with special symbols escaped

escape

public static String escape(String s)
Escapes ", <, >, and & in the given string.

Parameters:
s - input string
Returns:
string with special symbols escaped

unescape

public static String unescape(String s)
Unescapes ", <, >, &, and character references in the given string.

Parameters:
s - input string
Returns:
string with special symbols unescaped

unescape

public static String unescape(String s,
                              int i,
                              int j)
Unescapes a single ", <, >, &, or character reference.

Parameters:
s - input string
i - start index
j - end index (exclusive)
Returns:
unescaped character (may be a surrogate pair)


Copyright © 2004-2007 Anders Møller & Claus Brabrand.