【发布时间】:2015-02-15 23:11:41
【问题描述】:
我一整天都试图从 Xpath 查询中获取值和标记,但我做不到。有人可以帮我处理我需要使用的 xpath 查询来获取它们吗?请看下面的html代码。
<html class="chrome webkit">
#shadow-root
<head>...</head>
<body id="jira" class="aui-layout aui-theme-default page-type-dashboard" data-version="6.1.2" data-aui-version="5.1.6">
<div id="page">
<header id="header" role="banner">...</header>
<div id="announcement-banner" class="alertHeader">
<b> Production </b>
<marquee scrollamoun="3" behaviour="alternate" onmouseover="this.stop()" onmouseout ="this.start()">..</marquee>
<#shadow-root
<font-color="red"> Note:Please check out 1.</font>
<a href="https://docs.google.com/a/query.com/document/" target="_blank">
<b>
<font color ="red"> GSD Service </font>
</b>
</a>
</marquee>
</div>
<section id="content" role="main">...</section>
<footer id="footer" role="contentinfo">...</footer>
</div>
<div class="shim hidden"></div>
<div class="shim hidden"></div>
<div class="shim hidden"></div>
<div class="shim hidden"></div>
<div class="shim hidden"></div>
<div class="shim hidden"></div>
</body>
</html>
同样,我在这个标签之后还有另外三个 a 标签,所以我想分别获取所有 a 标签和 b 标签以在我的应用程序中显示它。请帮助我处理 XPath 查询。
【问题讨论】:
标签: html xml xpath xpath-2.0 domxpath