I'm trying to use htmlcleaner to remove all css from code, Ids and classes too.
There is a proper way to apply a transformation like like this weird, wrong code?
tt = new TagTransformation("*","*",true);
tt.addAttributeTransformation("style","");
tt.addAttributeTransformation("id","");
tt.addAttributeTransformation("class","");
Thanks in advance;
Marcelo,
Brazil
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can use global transformations for this. Here is an example from the test suite that removes any attributes starting with "on" such as "onmouseover":
:::Java
CleanerTransformations transformations = new CleanerTransformations();
AttributeTransformationPatternImpl attPattern = new AttributeTransformationPatternImpl(Pattern.compile("^\\s*on", Pattern.CASE_INSENSITIVE), null, null);
transformations.addGlobalTransformation(attPattern);
CleanerProperties props = cleaner.getProperties();
props.setCleanerTransformations(transformations);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm trying to use htmlcleaner to remove all css from code, Ids and classes too.
There is a proper way to apply a transformation like like this weird, wrong code?
Thanks in advance;
Marcelo,
Brazil
Hallo,
This is an old entry, but has someone found a solution for this?
The Wildcard "*" seems not to work in the current Version.
Thx a lot for any hint on this,
Willi
You can use global transformations for this. Here is an example from the test suite that removes any attributes starting with "on" such as "onmouseover":