Select elements between elements

I'm building a scraper for a page that has the following structure (I've selected down to this element, and my goal is to get candidate-level information while retaining the precinct names from which I got it):

<div id="county">
    <div class="county-name">...</div>
    <div class="precinct-name">...</div>
    <div class="candidate">...</div>
    <div class="candidate">...</div>
    <div class="candidate">...</div>
    <div class="precinct-name">...</div>
    <div class="candidate">...</div>
    <div class="candidate">...</div>
    <div class="candidate">...</div>
</div>

Where, all within one div, they have child elements for county (formatted to look like a title) then precinct name then the candidates. Every county has one county name, but each county has a variable number of precincts, and each county has a variable number of candidates. For what it's worth, each precinct under each county would have the same number of candidates.

If I use something like ">div.county div" I'm stuck with precinct titles in line with the candidate information. Ideally, I'd like to select the element like "> div.county > div.precinct-name" then subsidiary to that bang out some ">candidate" information, but obviously that's not an option.

If jQuery were available, I'd use something like nextUntil but again, dreams.

Is there any way for me to do this?

Hard to diagnose without the site Url but I'd say it would be hard to properly group the precinct-candidate info with WS alone . The problem is all the divs are on the same level, i.e. all are child of div#county, so it is hard to pick them out with CSS.

I think your best bet is to grab the entire "county" chunk of HTML and do post-processing later, meaning you need a script or program to pick out and organize the candidate info.

Type: HTML
Selector: div#county