Forum Discussion

madrian's avatar
madrian
Guide
11 years ago

utils.html.stripper.from.owasp methods

hi!

 

I'm working on a custom component and I'd like to strip out some html elements from a string. I was looking at the "stripper methods" at http://community.lithium.com/t5/Developers-Knowledge-Base/utils-FreeMarker-context-object/ta-p/9345#stripperMethods

 

because I would like to keep some html tags in the string, I wanted to use this:

 

utils.html.stripper.from.owasp.newOptionsBuilder.allowElement(String element)

 

so I copy/pasted the example code which gives me this error:

 

Screen Shot 2014-06-25 at 16.38.20.png

am I doing something wrong? do I have to enable/change something? can somebody help me make this function work?

 

thank you!

  • DougS's avatar
    DougS
    Khoros Oracle

    It looks like we need to update that documentation because that example is incorrect.  Try this instead:

     

    <#assign stripperOptions = utils.html.stripper.from.owasp.optionsBuilder.allowElement("p").build() />
    ${utils.html.stripper.from.owasp.strip("<p>this will not be stripped</p><div>this will be stripped<div>", stripperOptions)}

     

    -Doug