public class XmlFriendlyNameCoder extends Object implements NameCoder, Cloneable
This NameCoder is designed to ensure the correct encoding and decoding of names used for Java types and fields to XML tags and attribute names.
The default replacements are:
Constructor and Description |
---|
XmlFriendlyNameCoder()
Construct a new XmlFriendlyNameCoder.
|
XmlFriendlyNameCoder(String dollarReplacement,
String escapeCharReplacement)
Construct a new XmlFriendlyNameCoder with custom replacement strings for dollar and the
escape character.
|
XmlFriendlyNameCoder(String dollarReplacement,
String escapeCharReplacement,
String hexPrefix)
Construct a new XmlFriendlyNameCoder with custom replacement strings for dollar, the
escape character and the prefix for hexadecimal encoding of invalid characters in XML
names.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
protected Map |
createCacheMap() |
String |
decodeAttribute(String attributeName)
Decode an attribute name to an object name.
|
String |
decodeNode(String elementName)
Decode a node name to an object name.
|
String |
encodeAttribute(String name)
Encode a meta-data name for an attribute in the target format.
|
String |
encodeNode(String name)
Encode an object name for a node in the target format.
|
public XmlFriendlyNameCoder()
public XmlFriendlyNameCoder(String dollarReplacement, String escapeCharReplacement)
dollarReplacement
- escapeCharReplacement
- public XmlFriendlyNameCoder(String dollarReplacement, String escapeCharReplacement, String hexPrefix)
dollarReplacement
- escapeCharReplacement
- public String decodeAttribute(String attributeName)
decodeAttribute
in interface NameCoder
attributeName
- the name of the attributepublic String decodeNode(String elementName)
decodeNode
in interface NameCoder
elementName
- the name of the nodepublic String encodeAttribute(String name)
encodeAttribute
in interface NameCoder
name
- the name of the meta-datapublic String encodeNode(String name)
encodeNode
in interface NameCoder
name
- the name of the object dataprotected Map createCacheMap()
Copyright © 2004–2016 XStream. All rights reserved.