From 1a22532991dc57f1cbdb8dbd4021575b8230984d Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Tue, 19 Jul 2011 05:09:46 +0000 Subject: [PATCH] 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 --- src/site/xdoc/article3_0.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/site/xdoc/article3_0.xml b/src/site/xdoc/article3_0.xml index e73ed747e..ed3748287 100644 --- a/src/site/xdoc/article3_0.xml +++ b/src/site/xdoc/article3_0.xml @@ -142,14 +142,14 @@ available in the user guide.

Here we see that ESCAPE_XML is a 'CharSequenceTranslator', 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):

-          StringEscapeUtils.ESCAPE_XML.with( new UnicodeEscaper(Range.between(0x7f, Integer.MAX_VALUE) ) );
+          StringEscapeUtils.ESCAPE_XML.with( NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );
 

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:

           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)
               )
           )