[Htmlparser-user] extract table
Brought to you by:
derrickoswald
From: alaeddine <ala...@sa...> - 2009-03-24 14:51:56
|
Hi when i test the next code ///////////////////////// Parser parser = new Parser(url); NodeList nl = parser.parse(null); for (NodeIterator iterator = n1.elements(); iterator.hasMoreNodes();) { Node node = iterator.nextNode(); if (node instanceof Tag) { Tag tag = (Tag) node; ////////////////// i usually have a result outside test ' if (node instanceof Tag) {' so how i can progress in the next node and test if the name of the tag is body or not? Thank you for your help > Message: 2 > Date: Tue, 24 Mar 2009 12:31:49 +0100 > From: "alaeddine" <ala...@sa...> > Subject: [Htmlparser-user] Help me > To: <htm...@li...> > Message-ID: <E716CD9DBF704D9A9E982AB95DE9BDE7@aladin> > Content-Type: text/plain; charset="iso-8859-1" > > Hi > > I would to extract a table from a html url and i cant make a filter > > please help me to do this > > Thank you for your help > -------------- next part -------------- > An HTML attachment was scrubbed... > > ------------------------------ > > Message: 3 > Date: Tue, 24 Mar 2009 17:24:44 +0530 > From: Aravind R Pillai <Ara...@in...> > Subject: Re: [Htmlparser-user] Help me > To: htmlparser user list <htm...@li...> > Message-ID: > <E92...@BL...> > > Content-Type: text/plain; charset="us-ascii" > > Hi > > Parser parser = new Parser(url); > NodeList nl = parser.parse(null); > > This will give u firsrt set of all nodes. Like every node that's is inside > the <html> tag. > > for (NodeIterator iterator = n1.elements(); iterator.hasMoreNodes();) { > Node node = iterator.nextNode(); > if (node instanceof Tag) { > Tag tag = (Tag) node; > This way u will get every node and cast it to tag from that u can get the > tag name.compare it to "BODY". > Once tag body is obtained take the children and repeat the same process > using for loop until u get tag name "TABLE". > > U have to iterate through every tag.no other way.. try using a recursion. > > From: alaeddine [mailto:ala...@sa...] > Sent: Tuesday, March 24, 2009 5:02 PM > To: htm...@li... > Subject: [Htmlparser-user] Help me > > Hi > > I would to extract a table from a html url and i cant make a filter > > please help me to do this > > Thank you for your help > > **************** CAUTION - Disclaimer ***************** > This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended > solely > for the use of the addressee(s). If you are not the intended recipient, > please > notify the sender by e-mail and delete the original message. Further, you > are not > to copy, disclose, or distribute this e-mail or its contents to any other > person and > any such actions are unlawful. This e-mail may contain viruses. Infosys > has taken > every reasonable precaution to minimize this risk, but is not liable for > any damage > you may sustain as a result of any virus in this e-mail. You should carry > out your > own virus checks before opening the e-mail or attachment. Infosys reserves > the > right to monitor and review the content of all messages sent to or from > this e-mail > address. Messages sent to or from this e-mail address may be stored on the > Infosys e-mail system. > ***INFOSYS******** End of Disclaimer ********INFOSYS*** > -------------- next part -------------- > An HTML attachment was scrubbed... > > ------------------------------ > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > > ------------------------------ > > _______________________________________________ > Htmlparser-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlparser-user > > > End of Htmlparser-user Digest, Vol 30, Issue 2 > ********************************************** |