Re: [Htmlparser-user] getting data next to the current tag
Brought to you by:
derrickoswald
From: Derrick O. <der...@ro...> - 2007-09-25 22:38:59
|
You should be able to get the parent node and from there navigate past the = original node.=0AIf it was as simple as you say, this should work...=0A=0A = gender_node =3D my_heading_node.getParent ().getChildren ().elementAt (1)= ; // 0 is the header=0A=0A address_node =3D my_heading_node.getParent ().= getChildren ().elementAt (3);=0A=0A=0AYou will need to watch out for extran= eous whitespace and other nodes like <br/>.=0A=0A----- Original Message ---= -=0AFrom: Angelo Chen <ang...@ya...>=0ATo: htmlparser-user@li= sts.sourceforge.net=0ASent: Tuesday, September 25, 2007 6:16:42 AM=0ASubjec= t: [Htmlparser-user] getting data next to the current tag=0A=0AHi,=0A=0AI h= ave some lines like following, I can use:=0A a1 =3D nl.extractAllNodesThatM= atch(new=0ATagNameFilter("h1"),true);=0Ato reach <h1></h1>, and the gender = and address is=0Aalways below the <h1> line, how to access the two=0Alines = right after the <h1> tag? thanks.=0AA.C. =0A=0A <td ><h1>Angelo</h1>=0A = Male<br />San Jose, California <br />=0A </td>=0A=0A=0A Yaho= o! =A5=FE=B7s=A4=C9=AF=C5=BA=F4=A4W=AC=DB=C3=AF=A1A=C5=FD=A7A=A5=D1=AC=DB= =A4=F9=A4=A4=A4=C0=A8=C9=A5=CD=AC=A1=C2I=BAw=A1A=BD=D0=ABe=A9=B9http://hk.p= hotos.yahoo.com =A4F=B8=D1=A7=F3=A6h!=0A=0A=0A=0A=0A=0A=0A=0A |