0

我正在使用 antisamy 1.5.3 以及以下依赖项

  1. 蜡染1.5-fop-0.20-5.jar
  2. nekohtml-1.9.6.jar
  3. xercesImpl-2.9.1.jar

嗨,我有一个输入 html 字符串

str = "<p><ul>
              <li><span style=\"font-family: Arial, Helvetica, Verdana, Tahoma, sans-serif; font-size: 13px; line-height: 1.4em;\">Sample Output</span></li>
          </ul>
       </p>"

我希望 antisamy 的输出是相同的。但是我遇到了以下异常,有人可以告诉我哪里出错了吗?是否有解决此问题的方法。

ERROR:  ''
org.owasp.validator.html.ScanException: javax.xml.transform.TransformerException: java.lang.IllegalStateException
    at org.owasp.validator.html.scan.AntiSamySAXScanner.scan(AntiSamySAXScanner.java:135)
    at org.owasp.validator.html.AntiSamy.scan(AntiSamy.java:101)
    at com.tibbr.antisamy.TibbrAntisamy.getCleancontent(TibbrAntisamy.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:470)
    at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:328)
    at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:71)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
    at org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59)
    at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.ast.RescueNode.executeBody(RescueNode.java:224)
    at org.jruby.ast.RescueNode.interpret(RescueNode.java:119)
    at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:188)
    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
    at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    at org.jruby.ast.RootNode.interpret(RootNode.java:129)
    at org.jruby.evaluator.ASTInterpreter.INTERPRET_EVAL(ASTInterpreter.java:96)
    at org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:175)
    at org.jruby.RubyKernel.evalCommon(RubyKernel.java:1103)
    at org.jruby.RubyKernel.eval(RubyKernel.java:1061)
4

1 回答 1

0

我通过更新 antisamy.jar 的依赖 jar 解决了这个问题,依赖 jar 如下

  1. xercesImpl.jar
  2. xml-apis.jar
  3. nekohtml.jar
  4. sac.jar
  5. commons-httpclient-3.1.jar
于 2013-09-30T23:43:44.260 回答