---
title: "xpath Tricks"
author: "eonbell"
date: "2011-02-25T13:36:08Z"
tags: []
categories: ["编程语言"]
slug: "xpath-tricks"
draft: false
lastmod: "2011-02-25T13:36:08Z"
id: 929729
url: "https://eonbell.iteye.com/blog/929729"
---

how to find the text following "<br>" tag

for example:
html source code as below:
            <h3>Blood Substitutes (HBOCs): Is There a Downside?<br>
                <span class="details">Small Animal &gt; Emergency Medicine &amp; Critical Care
                <br>
                Tuesday | 8:00 AM - 8:50 AM | Mandalay Bay South Pacific F </span>
            </h3> 
we can find out the text following <br> by below summar  
   detail = root_dom.xpath(".//h3/br/following-sibling::text()")
   (session_date,session_time,session_room) = detail.split("|") 
of course we can find out the text before <bt> tag like this:
   detail = root_dom.xpath(".//h3/br/preceding-sibling::text()")