python/xpath question...

bruce bedouglas at earthlink.net
Thu Jul 6 12:25:12 EDT 2006


for guys with python/xpath expertise..

i'm playing with xpath.. and i'm trying to solve an issue...

i have the following kind of situation where i'm trying to get certain data.

i have a bunch of tr/td...

i can create an xpath, that gets me all of the tr.. i only want to get the
sibling tr up until i hit a 'tr' that has a 'th' anybody have an idea as to
how this query might be created?..


the idea would be to start at the "Summer B", to skip the 1st "tr", to get
the next "tr"s until you get to the next "Summer" section...

sample data.....

<tr> <Th colspan=14  class="soc_comment"> Summer B </th> </tr>
<!-- START RA.CTLIB(SOCPHDR1) -->
<tr>
<td nowrap valign="bottom" class="colhelp">
     <a href="#">Course<span>
     <b>Course</b>
     <br>Course number and suffix, if applicable.
     <br>C = combined lecture and lab course
     <br>L = laboratory course
          </span></a></td>
     </tr>
<!-- END RA.CTLIB(SOCPHDR1) -->
<tr>
<td valign="top" nowrap><a href="javascript:crsdescunderpop('AST1002');">AST
1002</a></td>
</tr>
<tr>
<td valign="top" nowrap><a
href="javascript:crsdescunderpop('AST1022L');">AST 1022L</a></td>
</tr>
<tr>
<td valign="top" nowrap><a
href="javascript:crsdescunderpop('AST1022L');">AST 1022L</a></td>
</tr>
<tr>
<td valign="top" nowrap><a
href="javascript:crsdescunderpop('AST1022L');">AST 1022L</a></td>
</tr>
<tr> <Th colspan=14  class="soc_comment"> Summer C </th> </tr>
<!-- START RA.CTLIB(SOCPHDR1) -->
<tr>
<td nowrap valign="bottom" class="colhelp">
     <a href="#">Course<span>
.
.
.

thanks...

-bruce





More information about the Python-list mailing list