I need to get the inner HTML as output for an input complete HTML. However, the getInnerHtml function returns an incomplete HTML that cannot be rendered. A few tags are not closed properly, resulting in this issue.
Usage:
String possibleUrlData="<input html value>";
TagNode cleanResultNode = cleanString(possibleUrlData);
String result = cleaner.getInnerHtml(cleanResultNode);
Example input tag:
<script defer="" src="/_next/static/chunks/6848-2e85e2aba8bb65b9.js"></script>
Output:
<script defer="" src="/_next/static/chunks/6848-2e85e2aba8bb65b9.js" />
When I close the output tag properly, the HTML becomes renderable.
Please suggest how to deal with this. I do not have much experience with HTMLs, so any advice regarding closing/removing the tags will be helpful.