I want to add custom logic/class to my custom Jackson JsonSerialize implementation such that it parses out html based on certain rules. For example, if html is inclosed in single quotes '<b>'text'</b>'
then the custom logic should accept the string as is. If its not in single quotes, like <b>text</b>
then I want the custom logic/class to return just text. Additionally, if I have a block of html enclosed in three single quotes '''<html><head><title>example</title></head></html>'''
it should accepted as is but if its not then only the example text should be returned and everything else parsed out. What is the best Java library to accomplish this? I thought about using AnitSamy but that leaves me open to an XSS attack since I need to accept anything inside quotes.
Examples:
input:<b>text</b>
output:text
input:'<b>'text'</b>'
output:'<b>'text'</b>'
input:<html><head><title>text</title></head></html>
output:text
input:'''<html><head><title>text</title></head></html>'''
output:'''<html><head><title>text</title></head></html>'''