Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.thoughtworks.xstream.io.xml
Class XmlFriendlyReplacer

    java.lang.Object
      com.thoughtworks.xstream.io.xml.XmlFriendlyReplacer

Direct Known Subclasses:
  XStream11XmlFriendlyReplacer

    public class XmlFriendlyReplacer

extends Object

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.

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

Constructor Summary
`XmlFriendlyReplacer()` Default constructor.
`XmlFriendlyReplacer(String dollarReplacement, String underscoreReplacement)` Creates an XmlFriendlyReplacer with custom replacements

Method Summary
`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

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(String dollarReplacement,
                               String underscoreReplacement)

  Creates an XmlFriendlyReplacer with custom replacements

  Parameters:
    `dollarReplacement` - the replacement for '$'
    `underscoreReplacement` - the replacement for '_'

Method Detail

### escapeName

    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

### unescapeName

    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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2008 XStream. All Rights Reserved.