我是新来的CSS,并尝试通过Java的Jsoup解析器解析HTML。CSS选择器“合并”元素
示例HTML:
<p>However much beautiful the s6 Edge looks, I doubt [...] the <a title="Samsung Unveils the Galaxy Note 4 and curved screen Note Edge" href="http://www.example.com/">Note Edge</a>, the dual gently curved screen [...] or accidental palm taps.</p>
我已经得到了<p>
元素中的文字如下:
Elements text = doc.select("p");
for (Element element : text) {
System.out.println(element.ownText() + "\n");
}
输出:
但是很多漂亮S6边缘看起来,我怀疑[...],双重 轻轻弯曲的屏幕或偶然的手掌水龙头。
人们可以看到,文Note Edge
insde的<a>
元素没有显示出来。
所以我想问是否有任何方法可行,显示整个文本,包括<a>
元素中的文字如下:
但是很多漂亮S6的边缘看起来,我怀疑[... ] 注边, 双轻轻弯曲的屏幕或偶然手掌水龙头。
我很满意每一个建议!
先生,你应该有一个奖牌的子节点。谢谢!! – user944351 2015-04-01 15:08:33