Parsing HTML 5 anchor tag with Tagsoup Parser

182 Views Asked by At

I am using tagsoup Parser which follows HTML4 and doesn't allow a <p> tag inside an <a> tag. Because of this,it is parsing incorrect HTML. I went through tagsoup docs but couldn't find any useful information through which tagsoup (org.ccil.cowan.tagsoup) can be configured to use HTML5 standards. e.g

<a href="/foreign-education-exam"><p >Study Abroad</p></a>

becomes

<a shape="rect" href="/foreign-education-exam" /><p>Study Abroad</p>
1

There are 1 best solutions below

1
On

Generally according to W3c standard you cannot make any p tag under a anchor tag.So because of that reason it might be converting your code.

Instead of p tag make use of span tag it will work for you sure.