com.thoughtworks.xstream.io.xml
Class XmlFriendlyReplacer

java.lang.Object
  extended by com.thoughtworks.xstream.io.xml.XmlFriendlyReplacer
Direct Known Subclasses:
XStream11XmlFriendlyReplacer

public class XmlFriendlyReplacer
extends java.lang.Object

Allows replacement of Strings in XML-friendly drivers. The default replacements are:

Since:
1.2
Author:
Mauro Talevi, Jörg Schaible, Tatu Saloranta

Constructor Summary
XmlFriendlyReplacer()
          Default constructor.
XmlFriendlyReplacer(java.lang.String dollarReplacement, java.lang.String underscoreReplacement)
          Creates an XmlFriendlyReplacer with custom replacements
 
Method Summary
 java.lang.String escapeName(java.lang.String name)
          Escapes name substituting '$' and '_' with replacement strings
 java.lang.String unescapeName(java.lang.String name)
          Unescapes name re-enstating '$' and '_' when replacement strings are found
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlFriendlyReplacer

public XmlFriendlyReplacer()
Default constructor.


XmlFriendlyReplacer

public XmlFriendlyReplacer(java.lang.String dollarReplacement,
                           java.lang.String underscoreReplacement)
Creates an XmlFriendlyReplacer with custom replacements

Parameters:
dollarReplacement - the replacement for '$'
underscoreReplacement - the replacement for '_'
Method Detail

escapeName

public java.lang.String escapeName(java.lang.String name)
Escapes name substituting '$' and '_' with replacement strings

Parameters:
name - the name of attribute or node
Returns:
The String with the escaped name

unescapeName

public java.lang.String unescapeName(java.lang.String name)
Unescapes name re-enstating '$' and '_' when replacement strings are found

Parameters:
name - the name of attribute or node
Returns:
The String with unescaped name


Copyright © 2004-2012 XStream. All Rights Reserved.