itextpdf 5.5和xmlworker 5.5 jar在Java中给Runtimeworker例外

问题描述 投票:0回答:1

[我在Chrome 79.0.3945.88(官方版本)(64位)和IE浏览器中得到itextpdf 5.5 jar的以下错误。

产生此错误的html内容。

Caused by: com.itextpdf.tool.xml.exceptions.RuntimeWorkerException: Invalid nested tag span</td found, expected closing tag span.
    at com.itextpdf.tool.xml.XMLWorker.endElement(XMLWorker.java:135)
    at com.itextpdf.tool.xml.parser.XMLParser.endElement(XMLParser.java:396)

    at com.itextpdf.tool.xml.parser.XMLParser.parse(XMLParser.java:175)
    at com.app.bean.Main.createPDF(Main.java:1113)

    ... 36 more

html内容:

<table ">
   <tr>
      <th style="font-weight:bold">Sl.No.</th>
     ..
   </tr>
   <tr>
     ..
      <td width="65%" align="left">
         <table border="0" cellspacing="0" cellpadding="3" align="left" style="border-collapse:collapse;" width="100%">

   <tr>
      ..
      <td width="65%" align="left">
         <table border="0" cellspacing="0" cellpadding="3" align="left" style="border-collapse:collapse;" width="100%">
            <tr>
               <td align="left"><b>Missing in Comparison File : </b><span style="background-color:LIGHTCOROL;">IT1**1*EA*297**VC*5315114*N4*49502010102</span></td>
            </tr>
            <tr>
               <td align="left"><b>Base File: </b>CTT*<span style="background-color:yellow;">2</span>*<span style="background-color:yellow;">1</span><br><br/><b>Comparison File: </b>CTT*<span style="background-color:yellow;">1</span>*<span style="background-color:yellow;">3</span><span style="background-color:yellow;">123</span</td>
            </tr>
            <tr>
               <td align="left"><b>Base File: </b>SE*<span style="background-color:yellow;">9</span>*618600001<br><br/><b>Comparison File: </b>SE*<span style="background-color:yellow;">8</span>*618600000</td>
            </tr>
         </table>
      </td>
   </tr>
   <tr>

      <td width="65%" align="left">
         <table border="0" cellspacing="0" cellpadding="3" align="left" style="border-collapse:collapse;" width="100%">
            <tr>

            </tr>

           ..
         </table>
      </td>
   </tr>
</table>
itext
1个回答
0
投票

在此行

<td align="left"><b>Base File: </b>CTT*[...]<span style="background-color:yellow;">123</span</td>
                                                                                      ^^^^^^

您看到最后一个关闭span缺少最后一个>

© www.soinside.com 2019 - 2024. All rights reserved.