After wasting 15 minutes trying to remember exactly how I did it in the past, I realized that I was using StringEscapeUtils from Apache commons-lang. So, having remembered that, it just works like magic, here is what I use to convert my xml/html samples in order to post them on Blogger:
this.class.classLoader.rootLoader.addURL(new File("/usr/local/java/grails-1.0/lib/commons-lang-2.1.jar").toURL())
xml = '''
<module id="id" version="0.0.1" package="package"> </module>
'''
org.apache.commons.lang.StringEscapeUtils.escapeHtml(xml).split("\n").each() {println it }
, which outputs the following :
<module id="id" version="0.0.1" package="package"> </module>
, which is what I paste into blogger and it works like magic !!!
No more running around like a headless chicken trying to find some service online that will convert my html/xml snippets !
No comments:
Post a Comment