Re: [Htmlparser-user] trouble understanding parser data flow
Brought to you by:
derrickoswald
From: Derrick O. <Der...@Ro...> - 2006-03-07 12:36:36
|
Filter the full node list: NodeList nl = parser.parse (null); NodeList list = nl.extractAllNodesThatMatch (filter); NodeList list2 = nl.extractAllNodesThatMatch (filter2); Antony Sequeira wrote: >Hi > >My first task was to extract links from pages >I looked at example and tried the following > > NodeFilter filter = new NodeClassFilter (LinkTag.class); > NodeList list = parser.extractAllNodesThatMatch (filter); > log("links follow:"); > for (int i = 0; i < list.size (); i++) > log (list.elementAt (i).toHtml ()); > >this works fine if the partser was just constrcuted before running this code > >On the other hand, if I put the following code preceeding the code above > NodeList nl = parser.parse (null); > log(nl.asString()); > >I get nothing for the links. > >How do I structure my code when I want to do multiple things while >parsing a page. >For example, I want to extract links, I want to extract forms and form >fields, I want to extract text. > >-Antony Sequeira > > > |