Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2004

Tip: Looking for answers? Try searching our database.

Swing HTMLParser problem

Thread view: 
JavaJug - 26 Jul 2004 11:46 GMT
Hi everybody.
Well. I am using the Swing HTML parser to parse some HTML files and store the
text (among other things) into memory. To do so I use a ParserCallback class
that extends HTMLEdotorkit.ParserCallback, and handle events such as
handleStart/EndTag(), handleText(), handleError()...
It worked very well until I realized that some <STYLE> tag (in the middle of my
page) don't trigger a "handleStartTag()" event, but a "handleError()" event. So
the code between <STYLE> and </STYLE> is computed as text, and as the parser
didn't detect the <style> as a tag, I can't know if the text belongs to such a tag.
Why this parser doesn't trigger a "handleStartTag()" when parsing a <style> tag
? Is anybody aware of that ?
Thank you in advance.
Xav
Thomas Weidenfeller - 26 Jul 2004 12:34 GMT
> Why this parser doesn't trigger a "handleStartTag()" when parsing a
> <style> tag ? Is anybody aware of that ?

The Swing HTML parser is rather limited. In fact, the parser is part of
the remains of Sun's old HotJava web browser. I don't belief it has been
updated since the days of HotJava.

If you need it for "real" HTML, and not just specifically for the parser
tailored HTML, you will get several such surprises. Consider using
another parser.

/Thomas
JavaJug - 26 Jul 2004 14:06 GMT
> If you need it for "real" HTML, and not just specifically for the parser
> tailored HTML, you will get several such surprises. Consider using
> another parser.

Yes, I was afraid os such an answear. I think i'll end up by switching to
another one, when I'll have some time (got a lot of code using this one...)

Thanks folks !
Anony! - 26 Jul 2004 13:00 GMT
> Hi everybody.
> Well. I am using the Swing HTML parser to parse some HTML files and store the
[quoted text clipped - 9 lines]
> Thank you in advance.
> Xav

style tag is supported, so don;t know why u getting this error.

check java sun tutorial on the html parser

AaA


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.