Search code examples
javatemplatesfreemarker

Java lib for parsing from a template (like a reverse Freemarker)?


Essentially, I have raw HTML code in a Java String and need to read out certain fragments of that code and save them in separate, pre-defined Strings.
I need to do this repeatedly (the fragments to be saved into variables may vary but the rest of the text will NOT), and since I'm already using Freemarker in another context I was wondering if there was any way to perform the same operation as Freemarker does in reverse, i.e. save text fragments into variables instead of creating the text using the variables.
I hope I've explained this well enough... Any ideas?


Solution

  • Is jsoup what you need? It can read specific contents out of HTML Strings