Jsoup Удалить родительский элемент - PullRequest
0 голосов
/ 13 июля 2020

Я хочу удалить тег, содержащий атрибут app_paragraph.

Но дочерние элементы не должны удаляться.

Код

String url = "https://someurl";

Connection conn = Jsoup.connect(url);

Document html = conn.get();

Elements rawContent = html.select(".writing_view_box div[style]").last().children();
rawContent.select("#dcappheader").remove();

System.out.print(rawContent);

Текущий выход (rawContent)

<p></p>
<div app_paragraph="Dc_App_text_0" app_editorno="0">
 <div>
  Title
 </div>
</div>
<p xss="removed"></p>
<div app_paragraph="Dc_App_Img_0" app_editorno="1">
 <img src="image_src">
</div>
<p></p>
<div app_paragraph="Dc_App_text_1" app_editorno="2"></div> 

Ожидаемый выход

<p></p>
<div>
 Title
</div>
<p xss="removed"></p>
 <img src="image_src">
<p></p> 
...