I know the main function of htmlParser aims at the
html tag. but I know it also privded the support to
jsp flag, just, it seems many defects exist in the
processing to jsp.
for example, my jsp as follow:
<%
// it's my comment
%>
<input type=<%= typeName%> value=1>
HTMLParser can't parse them correctly, in fact,
there's two tags in this file.
I debug the source code "org.htmlparser.lexer.Lexer"
and find method "parseJsp(int start)" doesn't process
such a situation.
I guess the following codes can be added to
method "parseJsp",
switch (state) {
...
case 2:
...
case '/': // // or /*
ch = mPage.getCharacter (mCursor);
if (ch == '/') {
// find the \n or \r
while(true) {
ch = mPage.getCharacter (mCursor);
if (ch == Page.EOF) {
done = true;
break;
} else if (ch == '\n' || ch == '\r') {
break;
}
}
} else if (ch == '*') {
char ch2 = mPage.getCharacter (mCursor);
while (true) {
ch = ch2;
ch2 = mPage.getCharacter (mCursor);
if (ch == Page.EOF) {
done = true;
break;
} else if (ch == '*' && ch2 == '/') {
break;
}
}
} else {
mCursor.retreat();
}
break;
besides, method "parseTag(int start)"
switch (state)
{
case 0:
...
if (ch == '<') {
call nextNode() to process <input
name=<...>>
}
Logged In: YES
user_id=605407
Handle single and double line comments within jsp nodes.
Second suggested alteration to handle jsp tags within tag
attributes wasn't implemented.