3

For a rich text editor that has to handle pasted HTML code from MS Office applications, I'm looking for a Java library that cleans up the content of all "style" attributes in HTML elements, so that only some CSS attributes are left:

  • background-color
  • border
  • color
  • font-family
  • font-weight
  • font-style
  • list-style-type
  • text-align
  • text-decoration
  • vertical-align

For creating a well-formed HTML document, I can use JTidy. For HTML element transformations (removing unwanted elements), I can use http://htmlparser.sourceforge.net/

Is there anything comparable for CSS attributes?

1 Answer 1

2

Try using a some CSS parser (like http://cssparser.sourceforge.net/) and SAC.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.