How to XML escaping with Apache Velocity?
问题 I am generating XML using Apache Velocity. What is the best (most straight-forward) way to XML-escape the output? (I saw there is an escape tool, but could not figure out it's dev state. I also think that XML escaping is something that is very likely supported by Velocity directly.) 回答1: Take a look at event handlers. eventhandler.referenceinsertion.class = org.apache.velocity.app.event.implement.EscapeXmlReference Escape tool is a production ready as well if you need to escape only selective