I have the following html string:
<h3>I only want this content</h3> I don't want this content <b>random content</b>
And I would like to only get the content from the h3 tags and remove the other content. I have the following:
String getArticleBody = listArt.getChildText("body");
StringBuilder mainArticle = new StringBuilder();
String getSubHeadlineFromArticle;
if(getArticleBody.startsWith("<h3>") && getArticleBody.endsWith("</h3>")){
mainArticle.append(getSubHeadlineFromArticle);
}
But this returns the whole content, which is not what I am after. If someone could help me that would be great thanks.