Re: [Htmlparser-user] running StringBean on Node
Brought to you by:
derrickoswald
From: Jeffrey B. <jb...@cs...> - 2007-01-07 21:24:14
|
> > I'd like to be able to run StringBean on a given Node and have it give > > me all the text from that Node and from its descendants on down the > > DOM tree. I can do something similar on the whole page by using a > > Parser to first get a NodeList of all of the nodes in the tree and > > then run the following: > > > > StringExtractor sb = new StringExtractor(); > > all_nodes.visitAllNodesWith(sb); > > > > Is there a way to either get all of the descendants of a given Node or > > to otherwise get just the text from all the descendants of a given > > Node? Worst case, I can write my own recursive function that will > > gather up all the Nodes and their children and their descendants - I'm > > just thinking that there is probably an existing way to do this. > > > > Thanks! > > Jeff > > If the Node is a CompositeTag, you can (I think) use CompositeTag.accept(sb). This worked great - thanks for pointing it out! I'm sure that accept somehow makes sense as an intuitive name, but it was lost on me. -Jeff > Ian > > On 1/7/07, Jeffrey Bigham <jb...@cs...> wrote: > > Hi, > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share your > > opinions on IT & business topics through brief surveys - and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Htmlparser-user mailing list > > Htm...@li... > > https://lists.sourceforge.net/lists/listinfo/htmlparser-user > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Htmlparser-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlparser-user > |