Search code examples
muleanypoint-studio

How to parse HTML output


I am getting a HTML output after sending parameters to an API. Are there any good user-friendly examples on how to parse the HTML inside mule? Which Elements would be the best to use? Are there any common best practices?

I've been searching this for a while, but I couldn't find any answer. All I could find was either incomplete or related to json, and other output types. Any help is appreciated!


Solution

  • What does html response looks like? Surprised to see an API returning HTML!! How can it be API then :). Check with API provider if there is any machine-friendly response format they provide.

    Anyways, I don't think there is anything built-in mule to parse HTML.

    That said, you can write a java class and use that in Java Component element. I have used https://jsoup.org/ outside of mule to parse HTML and it is really good. You can try that.