I am trying to extract list of DIVs whose class = "child", and associate the "child" with a DIV whose class = "header" that occur before it.
For example:
<div class=header>HEADER A</div>
<div class=child>CHILD A.1</div>
<div class=child>CHILD A.2</div>
<div class=child>CHILD A.3</div>
<div class=header>HEADER B</div>
<div class=child>CHILD B.1</div>
<div class=child>CHILD B.2</div>
<div class=child>CHILD B.3</div>
I expect to have something like below
HEADER A --> CHILD A.1
HEADER A --> CHILD A.2
HEADER A --> CHILD A.3
HEADER B --> CHILD B.1
HEADER B --> CHILD B.2
HEADER B --> CHILD B.3
`) I have [an answer here](http://stackoverflow.com/questions/7827562/use-xpath-to-group-siblings-from-an-html-xml-document/7829248#7829248) that automatically groups headers and following siblings into sections.
– Phrogz Oct 26 '11 at 13:34