cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi All,

do you know if it's possible to decode an HTML string with XSJS?

I mean for example from $lt;mytag$gt; to <mytag> (replace $ with & otherwise it convert to text)

I found this library $.util.codec but don't contains nothing about HTML.

Gennaro

0 Likes
View Entire Topic
pfefferf
Active Contributor

I do not know a functionality/lib which is shipped with XS Classic to do HTML string escaping/unescaping. But you can create your own library providing that functionality.

Create a new xsjslib file e.g. utils.xsjslib in a package (e.g. tools) and paste following coding into it (sorry for the screenshot, but the code plugin coverts escaped character sequences). This library provides the functions escapeHtml and unescapeHtml for escaping/unescaping:

To use the library, just import it to your xsjs file and call the functions, e.g.

The example creates following result: