简体   繁体   English

Jsoup:在标记之前获取html最近的标记

[英]Jsoup: get the html nearest tag before a tag

I go a tag name <div id= "d1"> . 我去了一个标签名<div id= "d1"> But I want to know the tag, which is before this tag( the older bro/sis of this tag .anyone have an idea? 但是我想知道这个标签,在这个标签之前(这个标签的较早的兄弟/ sis。有人有想法吗?

I am using java. 我正在使用Java。

OP found an answer: OP找到了答案:

I think i got my own answer. 我想我有自己的答案。 It's lastElementSibling() . 这是lastElementSibling() I read it in this Jsoup API I hope this will help anyone like me now. 我在此Jsoup API中阅读了它,希望对现在像我这样的人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM