Escaping special character when generating an XML in Java

前端 未结 3 1719
甜味超标
甜味超标 2020-12-24 11:58

I am trying to develop an XML export feature to give my application users to export their data in an XML format. I have got this feature ready and working until it started f

3条回答
  •  长发绾君心
    2020-12-24 12:22

    Use the below code to escapes the characters in a String using XML.StringEscapeUtils is available in apche commons lang3 jar

    StringEscapeUtils.escapeXml11("String to be escaped");
    

提交回复
热议问题