Expand my Community achievements bar.

SOLVED

Load html to rich text field

Avatar

Level 1

Hello

In my xdp form I have a text field (named Comments) setting to rich text format. 

I receive a xml file , and in the Comments field of the xml I have html tags like <br/> or <b></b>.

 

How can I load the xml file correctly to the xdp field in order to keep the text well formatted?

Further, how can I send the less than signal (<) in that xml?

 

Many tanks

Pedro

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @pmcastro 

Use the below methods to escape and unescape HTML and XML string based on need.

  • org.apache.commons.lang3.StringEscapeUtils.escapeHtml4(String input)
  • org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4(String input)
  • org.apache.commons.lang3.StringEscapeUtils.escapeXml(String input)
  • org.apache.commons.lang3.StringEscapeUtils.unescapeXml(String input)

Hope this helps.

AG

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @pmcastro 

Use the below methods to escape and unescape HTML and XML string based on need.

  • org.apache.commons.lang3.StringEscapeUtils.escapeHtml4(String input)
  • org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4(String input)
  • org.apache.commons.lang3.StringEscapeUtils.escapeXml(String input)
  • org.apache.commons.lang3.StringEscapeUtils.unescapeXml(String input)

Hope this helps.

AG