public class XmlFriendlyNameCoder extends java.lang.Object implements NameCoder, java.lang.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:
The valid characters are defined by the intersection of the XML 1.0 specification (4th edition) and later specifications till XML 1.1 specification.
Constructor and Description |
---|
XmlFriendlyNameCoder()
Construct a new XmlFriendlyNameCoder.
|
XmlFriendlyNameCoder(java.lang.String dollarReplacement,
java.lang.String escapeCharReplacement)
Construct a new XmlFriendlyNameCoder with custom replacement strings for dollar and the escape character.
|
XmlFriendlyNameCoder(java.lang.String dollarReplacement,
java.lang.String escapeCharReplacement,
java.lang.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 |
---|---|
java.lang.Object |
clone() |
protected java.util.Map |
createCacheMap() |
java.lang.String |
decodeAttribute(java.lang.String attributeName)
Decode an attribute name to an object name.
|
java.lang.String |
decodeNode(java.lang.String elementName)
Decode a node name to an object name.
|
java.lang.String |
encodeAttribute(java.lang.String name)
Encode a meta-data name for an attribute in the target format.
|
java.lang.String |
encodeNode(java.lang.String name)
Encode an object name for a node in the target format.
|
public XmlFriendlyNameCoder()
public XmlFriendlyNameCoder(java.lang.String dollarReplacement, java.lang.String escapeCharReplacement)
dollarReplacement
- escapeCharReplacement
- public XmlFriendlyNameCoder(java.lang.String dollarReplacement, java.lang.String escapeCharReplacement, java.lang.String hexPrefix)
dollarReplacement
- escapeCharReplacement
- public java.lang.String decodeAttribute(java.lang.String attributeName)
decodeAttribute
in interface NameCoder
attributeName
- the name of the attributepublic java.lang.String decodeNode(java.lang.String elementName)
decodeNode
in interface NameCoder
elementName
- the name of the nodepublic java.lang.String encodeAttribute(java.lang.String name)
encodeAttribute
in interface NameCoder
name
- the name of the meta-datapublic java.lang.String encodeNode(java.lang.String name)
encodeNode
in interface NameCoder
name
- the name of the object datapublic java.lang.Object clone()
clone
in class java.lang.Object
protected java.util.Map createCacheMap()
Copyright © 2004–2024 XStream. All rights reserved.