Re: [Htmlparser-user] How to use it.
Brought to you by:
derrickoswald
|
From: Navid H.L. <na...@ya...> - 2002-11-19 19:39:36
|
Hi Somik,
I could do some parts of my program. And the result
was great. Thanks for all your helps. But yesterday I
found a bug, or most probably it is my mistake.
I used the sample in HTMLParser.java
* </pre>
* The above snippet will print out only the text
contents in the html document.<br>
* Here's another snippet that will only print out the
link urls in a document.
* This is an example of adding a link scanner.
* <pre>
* HTMLParser parser = new
HTMLParser("http://www.yahoo.com");
* parser.addScanner(new HTMLLinkScanner("-l"));
* for (Enumeration e =
parser.elements();e.hasMoreElements();) {
* HTMLNode node = (HTMLNode)e.nextElement();
* if (node instanceof HTMLLinkTag) {
* HTMLLinkTag linkTag = (HTMLLinkTag)node;
* System.out.println(linkTag.getLink());
* }
* }
* </pre>
* @see HTMLParser#elements()
It extract all urls of a page. But if the page url be
something like http://www.mysite.com/books/some.asp
and for example page has a link as href="newpage.html"
then the extracted url will be:
http://www.mysite.com/books/some.asp/newpage.html
which is wrong!
only if the instead some.asp I have some.html then the
url will be correct!
http://www.mysite.com/books/newpage.html
Would you please give me some guide line.
Thank you very much.
Nav
--- Somik Raha <so...@ya...> wrote:
> Navid wrote :
> > Thank you Somik, I could run some program to use
> > HTMLparser classes. But my question is , Does
> > HTMLparser works as a standalone program?
>
> The standalone is just a demonstration. HTMLParser
> is a library - you are
> expected to use it in your application. Check
> HTMLParser.java for more
> details.
>
> Regards,
> Somik
>
>
>
>
-------------------------------------------------------
> This sf.net email is sponsored by: To learn the
> basics of securing
> your web site with SSL, click here to get a FREE
> TRIAL of a Thawte
> Server Certificate:
> http://www.gothawte.com/rd524.html
> _______________________________________________
> Htmlparser-user mailing list
> Htm...@li...
>
https://lists.sourceforge.net/lists/listinfo/htmlparser-user
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
|