Hi,
It is quite easy to extract a particular tag from the parser given any of it's attribute name or value (or both), like the following :
NodeList list = newparse.extractAllNodesThatMatch(new AndFilter(new TagNameFilter("TR"),new HasAttributeFilter("Color","Green")));
Now suppose I want to execute the similar operation but with giving the attribute name and/or attribute value as a regular expression. When I tried (passing it as new RegexFilter) it throws an exception; hence I could not do this.
Is there a way out?
Best Wishes,
Shuvadeep
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You would need to make a filter to do that.
This has been done for the link tag by John Derrick.
You would need to loop over attribute values
See LinkRegexFilter.java:
Hi,
It is quite easy to extract a particular tag from the parser given any of it's attribute name or value (or both), like the following :
NodeList list = newparse.extractAllNodesThatMatch(new AndFilter(new TagNameFilter("TR"),new HasAttributeFilter("Color","Green")));
Now suppose I want to execute the similar operation but with giving the attribute name and/or attribute value as a regular expression. When I tried (passing it as new RegexFilter) it throws an exception; hence I could not do this.
Is there a way out?
Best Wishes,
Shuvadeep
You would need to make a filter to do that.
This has been done for the link tag by John Derrick.
You would need to loop over attribute values
See LinkRegexFilter.java:
http://cvs.sourceforge.net/viewcvs.py/htmlparser/htmlparser/src/org/htmlparser/filters/LinkRegexFilter.java?rev=1.4&view=markup