<div class="school_row_cell_content">
<div class="center_div">
<img src="/assets/isbiimages/c1504.jpg" alt="School Crest" width="190"></div>
Shelburne Road,
<br class="">Cheltenham,
<br class="">Gloucestershire,
<br class="">United Kingdom,
<br class="">GL51 6HE
<br class="">
<br class=""><strong>Tel:</strong> +44 1242 258000
<br class=""><strong>Fax:</strong> +44 1242 258004
<br class=""><br class=""><strong><a href="http://www.deanclose.org.uk" rel="nofollow" target="_blank" id="154" title="opens in new window" class="school_website_btn">Visit School Website</a></strong>
<br class="">
<br class=""><strong>Founded:</strong>1886<br class=""><br class=""><strong>Headmaster:</strong>
<br class=""><a href="/assets/isbiimages/ph1504.jpg" class="iframe_popups">Mr Bradley Salisbury</a>
<br class=""><br class=""><strong>Registrar:</strong>
<br class="">Mrs Kelly Serjeant
<br class="">
<br class="">This school offers flexi-boarding.
<br class="">
<br class=""><strong>Accreditations and affiliations:</strong>
<br class="">ISBA, HMC, BSA, AGBIS
<br class=""><strong>Religious affiliation:</strong>
<br class="">Church of England<br class=""><strong>Teaching languages:</strong>
<br class="">English
<br class="">
</div>
我试图根据他们的标签抓取某些字段,例如,我想抓住“成立;”在这个例子中将是1886年。还有“注册官:”,这将是凯莉·塞瑞特夫人。
我正在尝试各种变化而没有运气:
//strong[starts-with(., 'Registrar:')]//text()[not(parent::strong)]
不太确定我做错了什么。
答案 0 :(得分:0)
尝试:
//div[@class="school_row_cell_content"]//text()[.="Registrar:"]/following::text()[string-length()>0][1]
获取Mrs Kelly Serjeant
。
将"Registrar:"
替换为"Founded:"
//div[@class="school_row_cell_content"]//text()[.="Founded:"]/following::text()[string-length()>0][1]
获取1886
答案 1 :(得分:0)
您可以通过替换包含部分
中的文本来尝试使用xPath以下 Intent intent = getIntent();
String data= intent.getStringExtra("from");
if(data.equalsIgnoreCase("notificaton")
{
// call Mainactivity
}
else if(){}