commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <flame...@gmail.com>
Subject [LANG] text.translate [Was: Request for opinions]
Date Tue, 23 Jun 2009 06:22:11 GMT
I just committed the new text.translate package to Lang (r787560, see
LANG-505).

It rips the guts out of StringEscapeUtils and Entities, merges them
into a common paradigm and allows for reusable building blocks so the
answer to "I don't want low unicode escaped in my XML" can be "copy
and paste the 5 lines that define the rules for our escape algorithm".

I don't think the current escape methods are all perfect. One of the
things to do now is to refine those to define our new standard
approach. StringEscapeUtils can then provide the legacy hacks, and
possibly be moved to the back-compat jar someday.

Opinions very welcome.

Basic use for a user is that:

lang.StringEscapeUtils.escapeXml(text) becomes
lang.text.translate.EscapeUtils.ESCAPE_XML.translate(text).

Slightly longer. Another option is to copy the
StringEscapeUtils.escapeXml(String) variant down into EscapeUtils to
handle this common case.

Hen

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message