Sou*_*yer 0 java css-selectors html-parsing jsoup
给定HTML代码段,
<div align="right">...<div>
<p class="text2">abc</p>
Run Code Online (Sandbox Code Playgroud)
我已经使用jsoup来获取具有属性的所有元素,align设置为right.现在我想选择我使用的下一个兄弟姐妹,el.nextElementSibling()
How do I verify that the next element is a p HTML element with a class of text2? I am new to jsoup and I am learning as I code. Any help would be appreciated! Thanks!
Use Element#getTagName, which gives you the name of the tag for that element. That same API page also gives you Element#classNames and a couple of other ways to look at the class attribute.
| 归档时间: |
|
| 查看次数: |
2966 次 |
| 最近记录: |