@Immutable public class XmlNameEncoder extends Object implements TextDecoder, TextEncoder
encoder
and decoder
for XML element and attribute names.
Any UTF-16 unicode character that is not a valid XML name character according to the World Wide Web Consortium (W3C) Extensible Markup Language (XML) 1.0
(Fourth Edition) Recommendation is escaped as _xHHHH_
, where HHHH
stands for the four-digit
hexadecimal UTF-16 unicode value for the character in the most significant bit first order. For example, the name "Customer_ID"
is encoded as "Customer_x0020_ID".
Decoding transforms every _xHHHH_
encoding sequences back into the UTF-16 character. Note that
decoding
can be safely done on any XML name, even if the name does not contain any encoded sequences.
public String decode(String encodedText)
decode
in interface TextDecoder
encodedText
- the encoded textTextDecoder.decode(java.lang.String)
public String encode(String text)
TextEncoder
encode
in interface TextEncoder
text
- the text with characters that are to be encoded.TextDecoder.decode(String)
Copyright © 2008-2013 JBoss, a division of Red Hat. All Rights Reserved.