Skip to content Skip to sidebar Skip to footer

Jsoup Parse Error (tag Table Within Tag P)

When I parse this code with Jsoup:

[...]

Jsoup returns:

[...]
Is this a mistake? Ho

Solution 1:

I think it has to do with your example not being "valid" html. I believe a table cannot exist within a p tag. Jsoup is probably enforcing correct HTML.

Solution 2:

jsoup is very intelligent. It will reform your input text to the valid html conent, if you use its default parsing method.

Document doc = Jsoup.parse(html);

Actually, jsoup can handle xml-like text (certainly, including html and xml). You can try follwing method to parse xml-like text. It will not reform your input, and parse the input as it is.

Document doc = Jsoup.parse(html, "", Parser.xmlParser());

Post a Comment for "Jsoup Parse Error (tag Table Within Tag P)"