It looks like a bug in ParserUtils.getLinks() method, so you should file
this as a bug.
You may be able to fix it by inserting a guard around the cast to
CompositeTag:
CompositeTag jStartTag = (CompositeTag)links.elementAt(j);
and rebuilding the library. Something like:
if (links.elementAt(j) instanceof CompositeTag)
Derrick
Kevin R. Gutch wrote:
>Hello,
>
>I am trying to do the following:
>
>htmlRow = pu.trimTags(htmlRow, new String[] { "a" ,"img"}, false, false);
>
>However, I am receving this error.
>
>Caused by: java.lang.ClassCastException: org.htmlparser.tags.ImageTag
> at org.htmlparser.util.ParserUtils.getLinks(ParserUtils.java:1167)
> at org.htmlparser.util.ParserUtils.trimTags(ParserUtils.java:984)
> at com.protech.util.Table2Excel.exportHtmlTableAsExcel(Table2Excel.java:192)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>
>The error only occurs on the "img" string. If I remove it everything works fine.
>
>
>How can I solve this issue.
>
>Thanks in advance.
>
>
>
>
|