Thread: [Htmlparser-user] how to get a node struture with particular attribute
Brought to you by:
derrickoswald
From: answers s. <fas...@gm...> - 2008-05-23 09:00:02
|
hi i am filter like this NodeFilter filterClass = new AndFilter(new TagNameFilter("font"),new HasAttributeFilter("class","leftnavi")); I am using this filter aginst this Text <FONT class=leftnavi size=2> <a href="http://epaper.thehindu.com">ePaper</a><br<http://epaper.thehindu.com">epaper</a><br> > <A href="01hdline.htm">Front Page</A><BR> <A href="02hdline.htm">National</A><BR> <font class=leftnavi color=black>States:</font><br> • <A href="23hdline.htm">Tamil Nadu</A><BR> • <A href="21hdline.htm">Andhra Pradesh</A><BR> • <A href="22hdline.htm">Karnataka</A><BR> • <A href="25hdline.htm">Kerala</A><BR> • <A href="24hdline.htm">New Delhi</A><BR> • <A href="14hdline.htm">Other States</A><BR> <A href="03hdline.htm">International</A><BR> <A href="05hdline.htm">Opinion</A><BR> <A href="06hdline.htm">Business</A><BR> <A href="07hdline.htm">Sport</A><BR> <A href="10hdline.htm">Miscellaneous</A><BR> • <A href="10hdline.htm#019">Cartoons</A><BR> <A href="26hdline.htm">Engagements</A><BR> </FONT> but the i am getting is <FONT class=leftnavi size=2> but i want o/p as whole font tag as <FONT class=leftnavi size=2> <a href="http://epaper.thehindu.com">ePaper</a><br<http://epaper.thehindu.com">epaper</a><br> > <A href="01hdline.htm">Front Page</A><BR> <A href="02hdline.htm">National</A><BR> <font class=leftnavi color=black>States:</font><br> • <A href="23hdline.htm">Tamil Nadu</A><BR> • <A href="21hdline.htm">Andhra Pradesh</A><BR> • <A href="22hdline.htm">Karnataka</A><BR> • <A href="25hdline.htm">Kerala</A><BR> • <A href="24hdline.htm">New Delhi</A><BR> • <A href="14hdline.htm">Other States</A><BR> <A href="03hdline.htm">International</A><BR> <A href="05hdline.htm">Opinion</A><BR> <A href="06hdline.htm">Business</A><BR> <A href="07hdline.htm">Sport</A><BR> <A href="10hdline.htm">Miscellaneous</A><BR> • <A href="10hdline.htm#019">Cartoons</A><BR> <A href="26hdline.htm">Engagements</A><BR> </FONT> |
From: abdullah <abd...@id...> - 2008-05-23 13:47:45
|
what ive understood is that you want the children tag of the FONT tag ?and you've been able to have the FONT tag .. so just call .getChildern() funciton on the Node you've extracted e.g : NodeList childern =fontTag.getChildern() ; On Fri, May 23, 2008 at 11:59 AM, answers solutions < fas...@gm...> wrote: > hi > > i am filter like this > > > NodeFilter filterClass = new AndFilter(new TagNameFilter("font"),new > HasAttributeFilter("class","leftnavi")); > > > > I am using this filter aginst this Text > > <FONT class=leftnavi size=2> > <a href="http://epaper.thehindu.com">ePaper</a><br<http://epaper.thehindu.com%22%3Eepaper%3C/a%3E%3Cbr> > > > <A href="01hdline.htm">Front Page</A><BR> > <A href="02hdline.htm">National</A><BR> > <font class=leftnavi color=black>States:</font><br> > • <A href="23hdline.htm">Tamil Nadu</A><BR> > • <A href="21hdline.htm">Andhra Pradesh</A><BR> > • <A href="22hdline.htm">Karnataka</A><BR> > • <A href="25hdline.htm">Kerala</A><BR> > • <A href="24hdline.htm">New Delhi</A><BR> > • <A href="14hdline.htm">Other States</A><BR> > <A href="03hdline.htm">International</A><BR> > <A href="05hdline.htm">Opinion</A><BR> > <A href="06hdline.htm">Business</A><BR> > <A href="07hdline.htm">Sport</A><BR> > <A href="10hdline.htm">Miscellaneous</A><BR> > • <A href="10hdline.htm#019">Cartoons</A><BR> > <A href="26hdline.htm">Engagements</A><BR> > </FONT> > > > but the i am getting is <FONT class=leftnavi size=2> > > > but i want o/p as whole font tag as > > <FONT class=leftnavi size=2> > <a href="http://epaper.thehindu.com">ePaper</a><br<http://epaper.thehindu.com%22%3Eepaper%3C/a%3E%3Cbr> > > > <A href="01hdline.htm">Front Page</A><BR> > <A href="02hdline.htm">National</A><BR> > <font class=leftnavi color=black>States:</font><br> > • <A href="23hdline.htm">Tamil Nadu</A><BR> > • <A href="21hdline.htm">Andhra Pradesh</A><BR> > • <A href="22hdline.htm">Karnataka</A><BR> > • <A href="25hdline.htm">Kerala</A><BR> > • <A href="24hdline.htm">New Delhi</A><BR> > • <A href="14hdline.htm">Other States</A><BR> > <A href="03hdline.htm">International</A><BR> > <A href="05hdline.htm">Opinion</A><BR> > <A href="06hdline.htm">Business</A><BR> > <A href="07hdline.htm">Sport</A><BR> > <A href="10hdline.htm">Miscellaneous</A><BR> > • <A href="10hdline.htm#019">Cartoons</A><BR> > <A href="26hdline.htm">Engagements</A><BR> > </FONT> > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Htmlparser-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlparser-user > > |