Can't find end of comment: <!--main headers--->
Brought to you by:
derrickoswald
If a HTML comment has an extra "-", the parser gets confused and can't find the end of the comment.
Hence, a file containing this is treated as one big comment (THREE dashes before ">")
<!--main headers--->
<html>
<head>
</head>
</html>
The parser has no problems with this (TWO dashes before ">")
<!--main headers-->
<html>
<head>
</head>
</html>
Logged In: YES
user_id=605407
Originator: NO
I believe this case is handled by setting STRICT_REMARKS = false, on class org.htmlparser.lexer.Lexer.
Please retest.
Logged In: YES
user_id=345459
Originator: YES
The problem goes away when you set
Lexer. STRICT_REMARKS = false;
This may also be causing the program observed in this bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=1845913&group_id=24399&atid=381399
I would say that this issue is obscurely documented. The typical/random webpage often as a lot of comment cruft that will cause the parser to misbehave.
It should be noted on this page:
http://htmlparser.sourceforge.net/javadoc/doc-files/using.html
and the page that it described on, over escapes > :
http://htmlparser.sourceforge.net/javadoc/org/htmlparser/lexer/Lexer.html#STRICT_REMARKS
Typographically, it's hard to see the difference between
-->
--->
I will endeavor to figure out how to change to documentation and make improvements if I can.