public class

XmlFriendlyReplacer

extends Object
java.lang.Object
   ↳ com.thoughtworks.xstream.io.xml.XmlFriendlyReplacer
Known Direct Subclasses

Class Overview

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

  • $ (dollar) chars are replaced with _- (underscore dash) string.
  • _ (underscore) chars are replaced with __ (double underscore) string.

Summary

Public Constructors
XmlFriendlyReplacer()
Default constructor.
XmlFriendlyReplacer(String dollarReplacement, String underscoreReplacement)
Creates an XmlFriendlyReplacer with custom replacements
Public Methods
String escapeName(String name)
Escapes name substituting '$' and '_' with replacement strings
String unescapeName(String name)
Unescapes name re-enstating '$' and '_' when replacement strings are found
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public XmlFriendlyReplacer ()

Default constructor.

public XmlFriendlyReplacer (String dollarReplacement, String underscoreReplacement)

Creates an XmlFriendlyReplacer with custom replacements

Parameters
dollarReplacement the replacement for '$'
underscoreReplacement the replacement for '_'

Public Methods

public String escapeName (String name)

Escapes name substituting '$' and '_' with replacement strings

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

public String unescapeName (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