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.
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private transient Map | |
| private final String | |
| private final String | |
| private transient Map | |
| private static final BitSet | |
| private static final BitSet |
| Access | Constructor and Description |
|---|---|
| public | |
| public | XmlFriendlyNameCoder(String dollarReplacement, String escapeCharReplacement)
Construct a new XmlFriendlyNameCoder with custom replacement strings for dollar and the escape character. |
| public | 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 |
|---|---|
| public Object | |
| protected Map | |
| public String | decodeAttribute(String
the name of the attribute attributeName)Implements com. |
| private String | |
| public String | decodeNode(String
the name of the node elementName)Implements com. |
| public String | encodeAttribute(String
the name of the meta-data name)Implements com. |
| private String | |
| public String | encodeNode(String
the name of the object data name)Implements com. |
| private static boolean | |
| private static boolean | |
| private Object |
| dollarReplacement | back to summary |
|---|---|
| private final String dollarReplacement | |
| escapeCache | back to summary |
|---|---|
| private transient Map<K, V> escapeCache | |
| escapeCharReplacement | back to summary |
|---|---|
| private final String escapeCharReplacement | |
| hexPrefix | back to summary |
|---|---|
| private final String hexPrefix | |
| unescapeCache | back to summary |
|---|---|
| private transient Map<K, V> unescapeCache | |
| XML_NAME_CHARS | back to summary |
|---|---|
| private static final BitSet XML_NAME_CHARS | |
| XML_NAME_START_CHARS | back to summary |
|---|---|
| private static final BitSet XML_NAME_START_CHARS | |
| XmlFriendlyNameCoder | back to summary |
|---|---|
| public XmlFriendlyNameCoder() Construct a new XmlFriendlyNameCoder.
| |
| XmlFriendlyNameCoder | back to summary |
|---|---|
| public XmlFriendlyNameCoder(String dollarReplacement, String escapeCharReplacement) Construct a new XmlFriendlyNameCoder with custom replacement strings for dollar and the escape character.
| |
| XmlFriendlyNameCoder | back to summary |
|---|---|
| public 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.
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| createCacheMap | back to summary |
|---|---|
| protected Map | |
| decodeAttribute | back to summary |
|---|---|
| public String decodeAttribute(String attributeName) Implements com. Doc from com. Decode an attribute name to an object name. | |
| decodeName | back to summary |
|---|---|
| private String decodeName(String name) | |
| decodeNode | back to summary |
|---|---|
| public String decodeNode(String elementName) Implements com. Doc from com. Decode a node name to an object name. | |
| encodeAttribute | back to summary |
|---|---|
| public String encodeAttribute(String name) Implements com. Doc from com. Encode a meta-data name for an attribute in the target format. | |
| encodeName | back to summary |
|---|---|
| private String encodeName(String name) | |
| encodeNode | back to summary |
|---|---|
| public String encodeNode(String name) Implements com. Doc from com. Encode an object name for a node in the target format. | |
| isXmlNameChar | back to summary |
|---|---|
| private static boolean isXmlNameChar(final int cp) | |
| isXmlNameStartChar | back to summary |
|---|---|
| private static boolean isXmlNameStartChar(final int cp) | |
| readResolve | back to summary |
|---|---|
| private Object readResolve() | |