Parse html with jsoup and remove the tag block

后端 未结 4 1986
傲寒
傲寒 2021-01-05 06:00

I want to remove everything between a tag. An example input may be

Input:


  start
  
delete from below
4条回答
  •  情话喂你
    2021-01-05 06:29

    This may help you.

     String selectTags="div,li,p,ul,ol,span,table,tr,td,address,em";
     /*selecting some specific tags */
     Elements webContentElements = parsedDoc.select(selectTags); 
     String removeTags = "img,a,form"; 
     /*Removing some tags from selected elements*/
     webContentElements.select(removeTags).remove();
    

提交回复
热议问题