how to get comments from html or jsp page using jericho html parser

183 Views Asked by At

How to get comments like //Comments & /*Comments*/ from a html and jsp page.

I have got comments <!--Comments-->,<%--Comments--%>,<%Comments%> in following way using jericho html parser.

List<Tag> comments = source.getAllTags(StartTagType.COMMENT);(<!--Comments-->)
List<Tag> serverSideComments = source.getAllTags(StartTagType.SERVER_COMMON_COMMENT);
(<%--Comments--%>)
List<Tag> serverComments = source.getAllTags(StartTagType.SERVER_COMMON);("<%Comments%>")

but I am not able to find for // & /*Comments*/.

1

There are 1 best solutions below

0
andreyro On

Comments in html must start with <. If you add something stating with // will be interpreted just like a text. http://www.w3schools.com/html/html_comments.asp I think this is a standard and jericho does not have a way of customizing tags.