Re: [Htmlparser-developer] Is anyone can give me some help for using the Nodelist to delete the com
Brought to you by:
derrickoswald
|
From: Derrick O. <Der...@Ro...> - 2005-04-21 22:12:08
|
I think you want to keepAllNodesThatMatch recursively (i.e. use the
boolean recursive argument form):
nodelist.keepAllNodesThatMatch( new NotFilter(new
NodeClassFilter (RemarkNode.class), true);
That way, all the remarks that are children of the nodes in the node
list (and their children etc.) are also filtered out.
dualspacekimo wrote:
>I am confused with that....Nodelist's method
>
>Especially the NotFilter ...
>
>If I want to filter the RemarkNode.
>Is it possible that use the following code to achive
>the goal? I have write the code...but not skip the
>comment in the html.
>
>NodeList nodelist =
>parser.extractAllNodesThatMatch(new HasAttributeFilter
>("class","blogbody"));
>
>nodelist.keepAllNodesThatMatch( new NotFilter(new
>NodeClassFilter (RemarkNode.class));
>
>SimpleNodeIterator Noderator = nodelist.elements();
>while(Noderator.hasMoreNodes()){
>......//print the content
>}//end while
>
>
>
|