Re: [Htmlparser-user] running StringBean on Node
Brought to you by:
derrickoswald
From: Ian M. <ian...@gm...> - 2007-01-07 12:45:35
|
For a recursive function that walks the HTMLParser DOM-like structure, you can use the NodeTreeWalker class and just keep the text nodes. That's pretty simple. If the Node is a CompositeTag, you can (I think) use CompositeTag.accept(sb). Ian On 1/7/07, Jeffrey Bigham <jb...@cs...> wrote: > Hi, > > 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 > > ------------------------------------------------------------------------- > 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 > |