当任何HTML结束标记丢失时的Jsoup行为 [英] Jsoup behavior when any HTML end tag is missing

查看:97
本文介绍了当任何HTML结束标记丢失时的Jsoup行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当缺少一个HTML标记(开始标记或结束标记)时,Jsoup的默认行为是什么?它会抛出一个错误,或者它会忽略现有的标记或删除现有的标记吗?

解决方案

Jsoup会尽力做到最好,并在最明智的地方添加它,以符合 HTML5规范。当缺少开始标记时,Jsoup将删除结束标记。


What would be the default behavior of Jsoup whenever there is one missing HTML tag(either start tag or end tag)? Will it throw an error or would it ignore the existing tag or remove the existing tag?

解决方案

When the end tag is missing, Jsoup will try doing its best and add it at the most sensible place conform the HTML5 spec. When the start tag is missing, Jsoup will remove the end tag.

这篇关于当任何HTML结束标记丢失时的Jsoup行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆