I am trying to use JSoup with ColdFusion to clean up some HTML but am encountering the following error:
The addTags method was not found. Either t
The addTags
method expects an array of strings, not just a single string. Put the value into an array first:
<!--- create a CF array then cast it as type string[] --->
<cfset tagArray = javacast("string[]", ["span"]) >
<cfset post = jsoup.clean(post, Whitelist.none().addTags( tagArray ))>
Edit:
As far as I can see from other online examples this is the correct syntax
To clarify, that is the correct syntax - for java. In java you can pass in a variable number of arguments using either an array or this syntax: addTags("tag1", "tag2", ...)
. However, CF only supports the array syntax. So if you cfdump the java object, you will see square brackets after the class name, which indicates the argument is an array:
method: addTags( java.lang.String[] ) // array of strings