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

## org.modeshape.common.text
Class XmlNameEncoder

    java.lang.Object
      org.modeshape.common.text.XmlNameEncoder

All Implemented Interfaces:
  TextDecoder, TextEncoder

    @Immutable
    public class XmlNameEncoder

extends Object
implements TextDecoder, TextEncoder

An `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.

Constructor Summary
`XmlNameEncoder()`

Method Summary
`String` | `decode(String encodedText)` Return the decoded version of an encoded string
`String` | `encode(String text)` Returns the encoded version of a string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XmlNameEncoder

    public XmlNameEncoder()

Method Detail

### decode

    public String decode(String encodedText)

  Return the decoded version of an encoded string

  Specified by:
    `decode` in interface `TextDecoder`
  Parameters:
    `encodedText` - the encoded text
  Returns:
    the unecoded form of the text, or null if the supplied node name is also null
  See Also:
    `TextDecoder.decode(java.lang.String)`

### encode

    public String encode(String text)

  Returns the encoded version of a string.

  Specified by:
    `encode` in interface `TextEncoder`
  Parameters:
    `text` - the text with characters that are to be encoded.
  Returns:
    the text with the characters encoded as required, or null if the supplied text is null
  See Also:
    `TextEncoder.encode(java.lang.String)`

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 © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.