- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图打印用户新闻 col-section 列表 div 中的所有 div,但它总是返回 NULL 。我已经从页面中删除了 html 部分,但如果您愿意,我可以提供完整的代码。
我已经从页面中删除了 html 部分,但如果您愿意,我可以提供完整的代码。
感谢您的帮助。
Element itemlist = doc.select("div.user-news col-section list").first();
Elements items = itemlist.getAllElements();
for(Element e : items){
System.out.println(e.text());
}
<html>
<head>
<title> note </title>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta content="YzU6jJ3yJ0My_t6b2CmL_z-yjo9gN2QUO2MmQHjAgM0" name="google-site-verification">
<meta content="09278921fdde" name="bitly-verification">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="authenticity_token" name="csrf-param">
<meta content="EdoDpiYEuVH0NtErL3ok2BUJDFGXoRQDGdmTu8aIYTI=" name="csrf-token">
</head>
<body class="one-col small v3">
<div class="body-con">
<div class="v3-header" style="font-family: "Roboto","Helvetica Neue", Helvetica, Arial, sans-serif">
<header>
<ul class="account-info ">
<li class="dressing-rooms"><a class="user-action" data-pa-attr-location="header" data-pa-name="dressing_room_list" href="/dressing_rooms"><i class="icon double-hanger-gray"></i><span class="subtitle">Dressing Rooms</span></a></li>
<li class="likes-con"><a class="user-action" data-pa-attr-location="header" data-pa-name="my_likes" href="/likes"><i class="icon large-heart"></i><span class="subtitle">My Likes</span></a></li>
<li class="news"><a class="user-action active" data-pa-attr-location="header" data-pa-name="news" href="/news"><i class="icon notification"></i><span class="notification-count"></span><span class="subtitle">News</span></a></li>
<li class="account d">
<div class="dropdown">
<div aria-expanded="false" aria-haspopup="true" class="dropdown-toggle" data-toggle="dropdown">
<i class="user-pic-bck profile"></i>
</div>
<div class="dropdown-menu dropdown-menu-right caret">
<div class="dropdown-item">
<a href="/closet/tashabui"><span>My Closet</span></a>
</div>
<div class="dropdown-item">
<a href="/likes"><span>My Likes</span></a>
</div>
<div class="dropdown-item">
<a data-ajax-modal="true" data-dismiss="modal" data-toggle="ajax-modal" href="/user/my-size" target="#edit-my-size"><span>My Size</span></a>
</div>
<div class="dropdown-item">
<a data-pa-attr-location="header" data-pa-name="dressing_room_list" href="/dressing_rooms"><span>My Dressing Rooms</span></a>
</div>
<div class="dropdown-item">
<a href="/logout"><span>Logout</span></a>
</div>
</div>
</div></li>
</ul>
</div>
</nav>
<nav class="scrollable ">
<div class="nav-content">
<ul>
<li class="link"><a data-pa-attr-location="nav" data-pa-name="feed" href="/feed">Feed</a></li>
<li>
<div aria-expanded="false" aria-haspopup="true" class="dropdown title">
<a href="/category/Women"><span>Women's Clothing</span></a>
<div class="section col-x6 col-l4">
<div class="section-header">
Trending Styles
</div>
<div class="modal hide" data-keyboard="false" id="signup-popup-connect-con"></div>
<div class="flash-message-con v3">
<span class="flash-message"></span>
</div>
<div class="main-con v3">
<div class="user-news col-section list">
<h3 class="title">News</h3>
<div class="news-tabs news-tabs-v1-offers">
<span><a class="tab btn rounded grey active" href="/news" track_action="news_all_tab_click" track_category="user" track_label="55e88b96c2523186d101b68b">All</a></span>
<span><a class="tab btn rounded grey" href="/news/filtered" track_action="news_comments_tab_click" track_category="user" track_label="55e88b96c2523186d101b68b">Comments</a></span>
<span><a class="tab btn rounded grey" href="/news/offers" track_action="news_offers_tab_click" track_category="user" track_label="55e88b96c2523186d101b68b">Offers</a></span>
</div>
<div class="notification dev-action-item unread">
<a class="user_development_notification" data-action-type="pK49_060_L44_i19" data-command="{"url":"https://poshmark.com/getapp","type":"new_tab"}" data-pa-banner_name="pK49_060_L44_i19" data-pa-content_type="udn" data-pa-udn_type="edu" data-user-id="55e88b96c2523186d101b68b" href="https://poshmark.com/getapp" pac="udn" target="_blank">
<div class="dev-action-gradient purple">
<i class="sprite info"></i>
</div>Want to sell your stuff? Download Poshmark on your mobile device!
<div class="notification-arrow">
<i class="sprite read-unread arrow"></i>
</div></a>
</div>
<div actor_id="51f06d19911d8705f60000ac" class="notification read" data-uname="hsshall" notification_id="6271" user_id="51f06d19911d8705f60000ac">
<a class="action follow-action" data-fb-if-href="/mapp/find_friends/follow_back?username=hsshall&variation_id=fb_fb_v01" data-fi-if-href="/mapp/find_friends/follow_back?username=hsshall&variation_id=if_fb_v01" data-pa-content_type="follow" href="/closet/hsshall" pac="news_item"><img alt="T_58b464edb0c5fca22ca6bea2" class="profile" src="https://dtpmhvbsmffsz.cloudfront.net/users/2017/02/27/51f06d19911d8705f60000ac/t_58b464edb0c5fca22ca6bea2.jpg">
<div class="notification-arrow">
<i class="sprite read-unread arrow"></i>
</div>
<div class="content">
<i class="sprite news-follow icon"></i>
<span class="user-name">hsshall</span>
<span> is following you</span>
<div class="when">
39 minutes ago
</div>
</div></a>
</div>
<div actor_id="5571c9785a7f971337031670" banner_name="share_back" class="notification read" data-uname="edwards13" dest_user_id="5571c9785a7f971337031670" dest_user_name="edwards13" left_image_url="https://d2zlsagv0ouax1.cloudfront.net/assets/v2/icon/icon-share-back-white-91b22b2211615533df9bb6a84a841e2b.png" notification_id="6270" post_id="59f0e6a6291a35194301f619" redirect_protocol="poshmark" right_image_url="https://d2zlsagv0ouax1.cloudfront.net/assets/v2/icon/right-arrow-white-7a7520da1a87341fc00d2e14cd1ffe98.png" show_listing_banner="show_listing_banner">
<a class="action show-post-details" data-pa-content_type="share" href="/listing/59f0e6a6291a35194301f619?sharer_id=5571c9785a7f971337031670&sharer_username=edwards13" pac="news_item"><img alt="T_59e78f9b8a3f3e7551a24879" class="profile" src="https://dtpmhvbsmffsz.cloudfront.net/users/2017/10/18/5571c9785a7f971337031670/t_59e78f9b8a3f3e7551a24879.jpg">
<div class="post-details">
<img alt="M_59f0e724bcd4a762b501fa8b" class="post-pic" src="https://dtpmhvbsmffsz.cloudfront.net/posts/2017/10/25/59f0e6a6291a35194301f619/m_59f0e724bcd4a762b501fa8b.jpg">
<i class="sprite read-unread arrow"></i>
</div>
<div class="content">
<i class="sprite news-shared icon"></i>
<span class="user-name">edwards13</span>
<span> shared your listing</span>
<div class="when">
58 minutes ago
</div>
</div></a>
</div>
<div actor_id="575ca2188f005385af0471ae" class="notification read" data-uname="dames_doll" notification_id="6269" user_id="575ca2188f005385af0471ae">
<a class="action follow-action" data-fb-if-href="/mapp/find_friends/follow_back?username=dames_doll&variation_id=fb_fb_v01" data-fi-if-href="/mapp/find_friends/follow_back?username=dames_doll&variation_id=if_fb_v01" data-pa-content_type="follow" href="/closet/dames_doll" pac="news_item"><img alt="T_59f7d8d41bd3af36a467f6ee" class="profile" src="https://dtpmhvbsmffsz.cloudfront.net/users/2017/10/30/575ca2188f005385af0471ae/t_59f7d8d41bd3af36a467f6ee.jpg">
<div class="notification-arrow">
<i class="sprite read-unread arrow"></i>
</div>
<div class="content">
<i class="sprite news-follow icon"></i>
<span class="user-name">dames_doll</span>
<span> is following you</span>
<div class="when">
an hour ago
</div>
</div></a>
</div>
<div actor_id="532a42d814b1e0666c021bd2" class="notification read" data-uname="beyondblessed11" notification_id="6268" user_id="532a42d814b1e0666c021bd2">
<a class="action follow-action" data-fb-if-href="/mapp/find_friends/follow_back?username=beyondblessed11&variation_id=fb_fb_v01" data-fi-if-href="/mapp/find_friends/follow_back?username=beyondblessed11&variation_id=if_fb_v01" data-pa-content_type="follow" href="/closet/beyondblessed11" pac="news_item"><img alt="T_532a42e214b1e0666c021be3" class="profile" src="https://dtpmhvbsmffsz.cloudfront.net/users/2014/03/19/532a42d814b1e0666c021bd2/t_532a42e214b1e0666c021be3.jpg">
<div class="notification-arrow">
<i class="sprite read-unread arrow"></i>
</div>
<div class="content">
<i class="sprite news-follow icon"></i>
<span class="user-name">beyondblessed11</span>
<span> is following you</span>
<div class="when">
an hour ago
</div>
</div></a>
</div>
<div actor_id="4ff4b7956056d502fb03d0c9" banner_name="share_back" class="notification read" data-uname="masi911" dest_user_id="4ff4b7956056d502fb03d0c9" dest_user_name="masi911" left_image_url="https://d2zlsagv0ouax1.cloudfront.net/assets/v2/icon/icon-share-back-white-91b22b2211615533df9bb6a84a841e2b.png" notification_id="6267" post_id="59fc2176bf6df539100308da" redirect_protocol="poshmark" right_image_url="https://d2zlsagv0ouax1.cloudfront.net/assets/v2/icon/right-arrow-white-7a7520da1a87341fc00d2e14cd1ffe98.png" show_listing_banner="show_listing_banner">
<a class="action show-post-details" data-pa-content_type="share" href="/listing/59fc2176bf6df539100308da?sharer_id=4ff4b7956056d502fb03d0c9&sharer_username=masi911" pac="news_item"><img alt="T_59e3dc4d1e08ad3ac8364a6d" class="profile" src="https://dtpmhvbsmffsz.cloudfront.net/users/2017/10/15/4ff4b7956056d502fb03d0c9/t_59e3dc4d1e08ad3ac8364a6d.jpg">
<div class="post-details">
<img alt="M_59fc2183680278edaa02fc9c" class="post-pic" src="https://dtpmhvbsmffsz.cloudfront.net/posts/2017/11/03/59fc2176bf6df539100308da/m_59fc2183680278edaa02fc9c.jpg">
<i class="sprite read-unread arrow"></i>
</div>
<div class="content">
<i class="sprite news-shared icon"></i>
<span class="user-name">masi911</span>
<span> shared your listing</span>
<div class="when">
an hour ago
</div>
</div></a>
</div>
<div actor_id="4ff4b7956056d502fb03d0c9" banner_name="share_back" class="notification read" data-uname="masi911" dest_user_id="4ff4b7956056d502fb03d0c9" dest_user_name="masi911" left_image_url="https://d2zlsagv0ouax1.cloudfront.net/assets/v2/icon/icon-share-back-white-91b22b2211615533df9bb6a84a841e2b.png" notification_id="6266" post_id="59fbd44bbcd4a79e2d02223b" redirect_protocol="poshmark" right_image_url="https://d2zlsagv0ouax1.cloudfront.net/assets/v2/icon/right-arrow-white-7a7520da1a87341fc00d2e14cd1ffe98.png" show_listing_banner="show_listing_banner">
<a class="action show-post-details" data-pa-content_type="share" href="/listing/59fbd44bbcd4a79e2d02223b?sharer_id=4ff4b7956056d502fb03d0c9&sharer_username=masi911" pac="news_item"><img alt="T_59e3dc4d1e08ad3ac8364a6d" class="profile" src="https://dtpmhvbsmffsz.cloudfront.net/users/2017/10/15/4ff4b7956056d502fb03d0c9/t_59e3dc4d1e08ad3ac8364a6d.jpg">
<div class="post-details">
<img alt="M_59fbd49b5a49d0dc06022365" class="post-pic" src="https://dtpmhvbsmffsz.cloudfront.net/posts/2017/11/02/59fbd44bbcd4a79e2d02223b/m_59fbd49b5a49d0dc06022365.jpg">
<i class="sprite read-unread arrow"></i>
</div>
<div class="content">
<i class="sprite news-shared icon"></i>
<span class="user-name">masi911</span>
<span> shared your listing</span>
<div class="when">
an hour ago
</div>
</div></a>
</div>
<div actor_id="50c7b57782fe067bbf04afad" class="notification read" data-uname="cigi36" notification_id="6265" user_id="50c7b57782fe067bbf04afad">
<a class="action follow-action" data-fb-if-href="/mapp/find_friends/follow_back?username=cigi36&variation_id=fb_fb_v01" data-fi-if-href="/mapp/find_friends/follow_back?username=cigi36&variation_id=if_fb_v01" data-pa-content_type="follow" href="/closet/cigi36" pac="news_item"><img alt="T_59ce69057ce76f3f2b0f5704" class="profile" src="https://dtpmhvbsmffsz.cloudfront.net/users/2017/09/29/50c7b57782fe067bbf04afad/t_59ce69057ce76f3f2b0f5704.jpg">
<div class="notification-arrow">
<i class="sprite read-unread arrow"></i>
</div>
<div class="content">
<i class="sprite news-follow icon"></i>
<span class="user-name">cigi36</span>
<span> is following you</span>
<div class="when">
an hour ago
</div>
</div></a>
</div>
<div actor_id="57951c9402e917f8d26eb523" class="notification read" data-uname="collectionbyk" notification_id="6253" user_id="57951c9402e917f8d26eb523">
<a class="action follow-action" data-fb-if-href="/mapp/find_friends/follow_back?username=collectionbyk&variation_id=fb_fb_v01" data-fi-if-href="/mapp/find_friends/follow_back?username=collectionbyk&variation_id=if_fb_v01" data-pa-content_type="follow" href="/closet/collectionbyk" pac="news_item"><img alt="T_57951c9502e917f8d26eb52a" class="profile" src="https://dtpmhvbsmffsz.cloudfront.net/users/2016/07/24/57951c9402e917f8d26eb523/t_57951c9502e917f8d26eb52a.jpg">
<div class="notification-arrow">
<i class="sprite read-unread arrow"></i>
</div>
<div class="content">
<i class="sprite news-follow icon"></i>
<span class="user-name">collectionbyk</span>
<span> is following you</span>
<div class="when">
4 hours ago
</div>
</div></a>
</div>
<div actor_id="598fb04f9d78f83ba5008182" banner_name="share_back" class="notification read" data-uname="iheartcats97" dest_user_id="598fb04f9d78f83ba5008182" dest_user_name="iheartcats97" left_image_url="https://d2zlsagv0ouax1.cloudfront.net/assets/v2/icon/icon-share-back-white-91b22b2211615533df9bb6a84a841e2b.png" notification_id="6252" post_id="59fc14f19c6fcf6a8f02fdea" redirect_protocol="poshmark" right_image_url="https://d2zlsagv0ouax1.cloudfront.net/assets/v2/icon/right-arrow-white-7a7520da1a87341fc00d2e14cd1ffe98.png" show_listing_banner="show_listing_banner">
<a class="action show-post-details" data-pa-content_type="share" href="/listing/59fc14f19c6fcf6a8f02fdea?sharer_id=598fb04f9d78f83ba5008182&sharer_username=iheartcats97" pac="news_item"><img alt="T_59cc3094aba09e30bb0276df" class="profile" src="https://dtpmhvbsmffsz.cloudfront.net/users/2017/09/27/598fb04f9d78f83ba5008182/t_59cc3094aba09e30bb0276df.jpg">
<div class="post-details">
<img alt="M_59fc15022ba50ae5fd02feb4" class="post-pic" src="https://dtpmhvbsmffsz.cloudfront.net/posts/2017/11/03/59fc14f19c6fcf6a8f02fdea/m_59fc15022ba50ae5fd02feb4.jpg">
<i class="sprite read-unread arrow"></i>
</div>
<div class="content">
<i class="sprite news-shared icon"></i>
<span class="user-name">iheartcats97</span>
<span> shared your listing</span>
<div class="when">
5 hours ago
</div>
</div></a>
</div>
</div>
<div id="load-more">
<img alt="Loading" class="logo" src="//d2zlsagv0ouax1.cloudfront.net/assets/loading-84ea1d46fc13b7f69ce36f8f84e1e8ca.gif">
<span>Loading more..</span>
</div>
</div>
<div class="v3-header" style="font-family: "Roboto","Helvetica Neue", Helvetica, Arial, sans-serif">
<footer class="footer-bg">
<div class="ftr-3-0">
<div class="footer-content-links">
<div class="col-l6 col-m8">
<ul>
<li><h4>Shop Categories</h4></li>
<li><a href="/category/Women" data-pa-attr-location="footer" data-pa-name="category">Women</a></li>
<li><a href="/category/Men" data-pa-attr-location="footer" data-pa-name="category">Men</a></li>
<li><a href="/category/Kids" data-pa-attr-location="footer" data-pa-name="category">Kids</a></li>
<li><a href="/category/Women-Handbags" data-pa-attr-location="footer" data-pa-name="category">Handbags</a></li>
<li><a href="/category/Women-Shoes" data-pa-attr-location="footer" data-pa-name="category">Shoes</a></li>
<li><a href="/category/Women-Jewelry" data-pa-attr-location="footer" data-pa-name="category">Jewelry & Accessories</a></li>
<li><a href="/category/Women-Makeup" data-pa-attr-location="footer" data-pa-name="category">Makeup</a></li>
<li><a href="/category/Women-Dresses" data-pa-attr-location="footer" data-pa-name="category">Dresses</a></li>
</ul>
</div>
<div class="col-l6 col-m24">
<div class="col-l24 col-m15">
<div class="connect-group">
<div class="modal hide" data-backdrop="static" data-keyboard="false" id="page-modal-error">
<div class="modal-header">
<h5 class="popup-title">Error!</h5>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<input class="flat-btn blue primary" onclick="javascript:$(this).parent().parent().modal('hide');" value="OK" type="button">
</div>
</div>
<div id="fb-root" class=" fb_reset">
<div style="position: absolute; top: -10000px; height: 0px; width: 0px;">
<div>
</div>
</div>
<div style="position: absolute; top: -10000px; height: 0px; width: 0px;">
<div>
</div>
</div>
</div>
</body>
</html>
最佳答案
您对此 div 感兴趣:
<div class="user-news col-section list">
该 div 使用三个类:
如果您必须选择使用所有这三个类的第一个 div 元素,请执行以下操作:
Element itemlist = doc.select("div.user-news.col-section.list").first();
Elements items = itemlist.getAllElements();
for(Element e : items){
System.out.println(e.text());
}
用 .
分隔类名称,而不是用 空格
。
关于java - 空指针异常 JSOUP 解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47099863/
我刚接触 C 语言几周,所以对它还很陌生。 我见过这样的事情 * (variable-name) = -* (variable-name) 在讲义中,但它到底会做什么?它会否定所指向的值吗? 最佳答案
我有一个指向内存地址的void 指针。然后,我做 int 指针 = void 指针 float 指针 = void 指针 然后,取消引用它们以获取值。 { int x = 25; vo
我正在与计算机控制的泵进行一些串行端口通信,我用来通信的 createfile 函数需要将 com 端口名称解析为 wchar_t 指针。 我也在使用 QT 创建一个表单并获取 com 端口名称作为
#include "stdio.h" #include "malloc.h" int main() { char*x=(char*)malloc(1024); *(x+2)=3; --
#include #include main() { int an_int; void *void_pointer = &an_int; double *double_ptr = void
对于每个时间步长,我都有一个二维矩阵 a[ix][iz],ix 从 0 到 nx-1 和 iz 从 0 到 nz-1。 为了组装所有时间步长的矩阵,我定义了一个长度为 nx*nz*nt 的 3D 指针
我有一个函数,它接受一个指向 char ** 的指针并用字符串填充它(我猜是一个字符串数组)。 *list_of_strings* 在函数内部分配内存。 char * *list_of_strings
我试图了解当涉及到字符和字符串时,内存分配是如何工作的。 我知道声明的数组的名称就像指向数组第一个元素的指针,但该数组将驻留在内存的堆栈中。 另一方面,当我们想要使用内存堆时,我们使用 malloc,
我有一个 C 语言的 .DLL 文件。该 DLL 中所有函数所需的主要结构具有以下形式。 typedef struct { char *snsAccessID; char *
我得到了以下数组: let arr = [ { children: [ { children: [], current: tru
#include int main(void) { int i; int *ptr = (int *) malloc(5 * sizeof(int)); for (i=0;
我正在编写一个程序,它接受一个三位数整数并将其分成两个整数。 224 将变为 220 和 4。 114 将变为 110 和 4。 基本上,您可以使用模数来完成。我写了我认为应该工作的东西,编译器一直说
好吧,我对 C++ 很陌生,我确定这个问题已经在某个地方得到了回答,而且也很简单,但我似乎找不到答案.... 我有一个自定义数组类,我将其用作练习来尝试了解其工作原理,其定义如下: 标题: class
1) this 指针与其他指针有何不同?据我了解,指针指向堆中的内存。如果有指向它们的指针,这是否意味着对象总是在堆中构造? 2)我们可以在 move 构造函数或 move 赋值中窃取this指针吗?
这个问题在这里已经有了答案: 关闭 11 年前。 Possible Duplicate: C : pointer to struct in the struct definition 在我的初学者类
我有两个指向指针的结构指针 typedef struct Square { ... ... }Square; Square **s1; //Representing 2D array of say,
变量在内存中是如何定位的?我有这个代码 int w=1; int x=1; int y=1; int z=1; int main(int argc, char** argv) { printf
#include #include main() { char *q[]={"black","white","red"}; printf("%s",*q+3); getch()
我在“C”类中有以下函数 class C { template void Func1(int x); template void Func2(int x); }; template void
我在64位linux下使用c++,编译器(g++)也是64位的。当我打印某个变量的地址时,例如一个整数,它应该打印一个 64 位整数,但实际上它打印了一个 48 位整数。 int i; cout <<
我是一名优秀的程序员,十分优秀!