【发布时间】:2012-06-08 07:31:56
【问题描述】:
我想找到具有以下文本的确切节点:“公司”。到达该节点后,我想立即到达该节点之后的下一个文本节点,因为它包含公司名称。如何使用 Xpath 做到这一点?
XML 的片段是:
<div id="jobsummary">
<div id="jobsummary_content">
<h2>Job Summary</h2>
<dl>
<dt>Company</dt>
<!-- the following element is the one I'm looking for -->
<dd><span class="wrappable">Pinpoint IT Services, LLC</span></dd>
<dt>Location</dt>
<dd><span class="wrappable">Newport News, VA</span></dd>
<dt>Industries</dt>
<dd><span class="wrappable">All</span></dd>
<dt>Job Type</dt>
<dd class="multipledd"><span class="wrappable">Full Time</span></dd><dd class="multipleddlast"><span class="wrappable"> Employee</span></dd>
</dl>
</div>
</div>
我使用以下 xpath 进入公司标签://*[text()= 'Company']
现在我想进入下一个文本节点。我的 XML 是动态的。所以我不能硬编码像<dd> 这样的节点类型来获得公司价值。但这是肯定的,该值在 立即下一个文本节点中。
那么如何才能在文本为 Company 的节点之后立即到达文本节点?
【问题讨论】:
标签: xpath