[Htmlparser-user] help desperately needed! parser wont parse properly
Brought to you by:
derrickoswald
From: ope t. <op...@ho...> - 2002-09-12 18:54:07
|
Hello anyone.. Im using this parser on a research project. Im building a browser in java, using JEditorPane as the panel that displays the html on the websites. I have succeeded in doing that. The next step was to parse the links on the website and we came across this parser, anyway, i set up the kizna classes and i used this piece of code: //this is in the actionPerformed function, when you press the "GO" Button HTMLParser parser = new HTMLParser(urlAddress); parser.registerScanners(); for (Enumeration e = parser.elements();e.hasMoreElements();) { HTMLNode node = (HTMLNode)e.nextElement(); if (node instanceof HTMLLinkTag) { HTMLLinkTag linkTag = (HTMLLinkTag)node; System.out.println("Link Tag is " + linkTag.getLink()); } } when i run the browser with say, amazon.com, this is the result i get: ***************************************************** Address : http://www.amazon.com tagContents: a href="http://www.amazon.com/exec/obidos/subst/home/home.html/ref=wt_404page/" Link Tag is http://www.amazon.com/exec/obidos/subst/home/home.html/ref=wt_404page/ tagContents: table border=0 align=center cellpadding=4 tagContents: a href="http://www.amazon.com/exec/obidos/subst/home/home.html/ref=404page/" Link Tag is http://www.amazon.com/exec/obidos/subst/home/home.html/ref=404page/ ***********************************88 when i checked the link tag, its redirects to the amazon home page. Can someone pls tell me what im doing wrong? Thanks _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com |