Fixing documentation; it was pointing to UnicodeEscaper and not NumericEntityEscaper. Also updated the API to not be Range based as we dropped that.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1148166 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2011-07-19 05:09:46 +00:00
parent 2556149b64
commit 1a22532991
1 changed files with 3 additions and 3 deletions

View File

@ -142,14 +142,14 @@ available in the <a href="userguide.html#lang.concurrent.">user guide</a>.</p>
</pre>
<p>Here we see that <code>ESCAPE_XML</code> is a '<code>CharSequenceTranslator</code>', which in turn is made up of two lookup translators based on the basic XML escapes and another to escape apostrophes. This shows one way to combine translators. Another can be shown by looking at the example to achieve the old XML escaping functionality (escaping non-ASCII): </p>
<pre>
StringEscapeUtils.ESCAPE_XML.with( new UnicodeEscaper(Range.between(0x7f, Integer.MAX_VALUE) ) );
StringEscapeUtils.ESCAPE_XML.with( NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );
</pre>
<p>That takes the standard Commons Lang provided escape functionality, and adds on another translation layer. Another JIRA requested option was to also escape non-printable ASCII, this is now achievable with a modification of the above: </p>
<pre>
StringEscapeUtils.ESCAPE_XML.with(
new AggregateTranslator(
new UnicodeEscaper(Range.between(0, 31)),
new UnicodeEscaper(Range.between(0x80, Integer.MAX_VALUE))
NumericEntityEscaper.between(0, 31),
NumericEntityEscaper.between(0x80, Integer.MAX_VALUE)
)
)
</pre>