[英]JSOUP check if element is img
I have an object Elements xxx. 我有一个对象元素xxx。 Now I want to iterate over it and I would like to check if any element is
img
tag. 现在我想迭代它,我想检查是否有任何元素是
img
标记。 How can I do that ? 我怎样才能做到这一点 ?
You can use the tagName
: 您可以使用
tagName
:
Elements yourElements = ...
for( Element element : yourElements )
{
if( element.tagName().equals("img") == true)
{
// It's an 'img'
}
else
{
// It's not an 'img'
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.