Android 通过JSoup在WebView中仅获取一个Div(按类)
我正在尝试只获取一个div(按类)到我的webview。我对PHP或CSS一无所知,所以当我按类名解析它们时,我不知道该怎么做。我想取Android 通过JSoup在WebView中仅获取一个Div(按类),android,webview,jsoup,Android,Webview,Jsoup,我正在尝试只获取一个div(按类)到我的webview。我对PHP或CSS一无所知,所以当我按类名解析它们时,我不知道该怎么做。我想取 部分在这里,但它太复杂了,所以我真的不知道在doc.select(div.“here”)上写什么。谢谢你的建议 我必须解析的div: <div id="wrap_all"> <div class="mobil-logo"> <div id="main" data-scroll-offset="88">
部分在这里,但它太复杂了,所以我真的不知道在doc.select(div.“here”)上写什么。谢谢你的建议
我必须解析的div:
<div id="wrap_all">
<div class="mobil-logo">
<div id="main" data-scroll-offset="88">
<!--- header icerik sonu--->
<div class="container_wrap container_wrap_first main_color fullsize">
<div class="container">
这对我很有用:
String url = "http://isvecehliyet.se/mobil/";
Document doc = Jsoup.connect(url).get();
Elements e = doc.select("div.container").first().parents();
System.out.println(e);
部分输出:
<div class="container_wrap container_wrap_first main_color fullsize">
<div class="container">
<main class="template-page content av-content-full alpha units" role="main" itemprop="mainContentOfPage">
<article class="post-entry post-entry [...]
你在那个部门需要什么?图片、段落或标题?还不清楚。@YuvaRaj,OP想要整个div,这样他就可以得到其中的HTML。
<div class="container_wrap container_wrap_first main_color fullsize">
<div class="container">
<main class="template-page content av-content-full alpha units" role="main" itemprop="mainContentOfPage">
<article class="post-entry post-entry [...]