0

こんにちは、HTML を PDF に変換するときにエラーが発生します。これが私の HTML です。

String html = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
            + "<html>"
            + "<head><style>"
            + "@font-face { "
            + "  src: url(arial.ttf); "
            + "  -fs-pdf-font-embed: embed; "
            + "  -fs-pdf-font-encoding: Identity-H;}"
            + "html *"
            + "{font-size: 11px;"
            + " font-family: Arial;}"
            + "</style></head>"
            + "<body>"
            + "<div id=\"logo\" class=\"media\" data-src=\"gsis.PNG\" style=\"width: 90px; height: 90px\" ></div>"
            + "<p style=\"text-align: center; line-height: 90%; \">Statement of Members Account</p>"
            + "<p style=\"text-align: center; line-height: 90%; \">Premium and Loan Account Balances Index</p>"
            + "<p style=\"text-align: center; line-height: 90%; \">As of "+ dateFormat.format(date) +"</p>"
            + "<br></br>"
            + "<table style=\"width: 100%;\">"
            + var1
            + "</table>"
            + "<br></br>"
            + "<hr></hr>"
            + "<br></br>"
            + "<p>This is the summary of your premium and loan account balances on record with GSIS as of "+ dateFormat.format(date) +"."
            + " To view a more updated summary and detailed account balances, you can go to "
            + "<span style=\"color: #0000ff; font-style: italic; text-decoration: underline;\">www.gsis.gov.ph</span> and log-on to eGSISMO."
            + "</p>"
            + "<p>In case of any discrepancy, please coordinate with your Personnel/Accounting Office to facilitate reconciliation of your record"
            + "and accounts with GSIS.</p>"
            + "<br></br>"
            + "I. PREMIUM ACCOUNT"
            + "<br></br>"
            + "<table border=\"1\" style=\"width: 100%; \">"
            + "<tr>"
            + "<td>Policy Type</td>"
            + "<td>Policy Number/Insurance Account</td>"
            + "<td>Due</td>"
            + "<td>Interest</td>"
            + "<td>Total</td>"
            + "</tr>"
            + var2
            + "</table>"
            + "<br></br>"
            + "<br></br>"
            + "II. LOAN ACCOUNT"
            + "<br></br>"
            + "<table border=\"1\" style=\"width: 100%; \">"
            + "<tr>"
            + "<td>Loan Type</td>"
            + "<td>Contract Account</td>"
            + "<td>Date Loan Granted</td>"
            + "<td>Gross Loan Amount</td>"
            + "<td>Monthly Amort</td>"
            + "<td>Total Repayment</td>"
            + "<td>Principal Balance</td>"
            + "<td>Interest/Surcharge</td>"
            + "<td>Outstanding Balance</td>"
            + "</tr>"
            + var3
            + "<br></br>"
            + "</table>"
            + "<br></br>"
            + "<br></br>"
            + "III. Period with Premium Payment (PPP)"
            + "<table cellpadding=\"10\" border=\"1\" style=\"width: 100%; \">"
            + var4
            + "</table>"
            + "<br></br>"
            + "<br></br>"
            + "LEGEND:"
            + "<br></br>"
            + "<p>A. Total Length of Service is the total number of years, months, days you are in government service.</p>"
            + "<p>B. Total Leave of Absence WITHOUT Pay (LWOP) is the period of time where no actual service was rendered "
            + "and paid. As such, premium payment for said period of time is not required. In which case, the period is not "
            + "considered in the computation of total length of service.</p>"
            + "<p>C. Actual Length of Service is the Total Length of Service less Total Leave of Absence WITHOUT Pay</p>"
            + "<p>D. Actual Length of Service WITH Posted Premium Payment (PPP) is the number of years in service"
            + " wherein correct premium payments have been paid and posted.</p>"
            + "<p>E. Actual Length of Service WITHOUT Posted Premium Payment (PPP) is the number of years in service "
            + "that do not have premium payments. This is subject to reconciliation with the member and agency record.</p>"
            + "<p>F. Equivalent Salary Based on Posted Premium Payment is the salary which had paid premium payment. This "
            + "salary will be used in the computation of gross loan amount.</p>"
            + "</body>"
            + "</html>";

ええ、より多くの言葉遣い。HTML コード全体で & が見つかりません。では、このエラーはどこから来るのでしょうか?:

 ERROR:  'The entity name must immediately follow the '&' in the entity reference.'
org.xhtmlrenderer.util.XRRuntimeException: Can't load the XML resource (using TRaX transformer). org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.

var1

 String var1 = "<tr>"
            + "<td style=\"align: left; width: 80px; \">Name:</td>"
            + "<td colspan=\"4\" style=\"width: 60%;\">" + fullName + "</td>"
            + "</tr>"
            + "<tr>"
            + "<td style=\"align: left; width: 80px; \">Address:</td>"
            + "<td colspan=\"4\" style=\"width: 60%;\">" + address + "</td>"
            + "</tr>"
            + "<tr>"
            + "<td style=\"align: left; width: 80px; \">Agency:</td>"
            + "<td colspan=\"4\" style=\"width: 60%;\">" + agencyName + "</td>"
            + "</tr>"
            + "<tr>"
            + "<td style=\"align: left; width: 80px; \"></td>"
            + "<td colspan=\"4\" style=\"width: 60%;\">" + agencyAddress + "</td>"
            + "</tr>"
            + "<tr>"
            + "<td style=\"align: left; width: 80px; \">Date of Birth:</td>"
            + "<td style=\"width: 60%;\">" + dob + "</td>"
            + "<td style=\"align: left;\">CRN:</td>"
            + "<td>" + crn + "</td>"
            + "</tr>"
            + "<tr>"
            + "<td style=\"align: left; width: 80px; \">BP No:</td>"
            + "<td style=\"width: 60%;\">" + bp + "</td>"
            + "<td style=\"align: left;\">ID No:</td>"
            + "<td>" + id + "</td>"
            + "</tr>";

var2

String var2 = "<tr>"
            + "<td>" + policyType + "</td>"
            + "<td>" + policyNumber + "</td>"
            + "<td>" + personalShare + "</td>"
            + "<td>" + psLifeInterest + "</td>"
            + "<td>" + psTotal + "</td>"
            + "</tr>";

var3

String var3 = null;

        var3 += "<tr>"
                + "<td>" + loanType + "</td>"
                + "<td>" + contract + "</td>"
                + "<td>" + dateLoanGrancted + "</td>"
                + "<td>" + grossAmt + "</td>"
                + "<td>" + totAmortAmt + "</td>"
                + "<td>" + totRepaymentAmt + "</td>"
                + "<td>" + obPrincipalAmt + "</td>"
                + "<td>" + intSurAmt + "</td>"
                + "<td>" + obTotAmt + "</td>"
                + "</tr>";

var4

String var4 = "<tr>"
            + "<td style=\"width:10px;\">A</td>"
            + "<td style=\"width:60%;\">Total Length of Service (TLS) in Years</td>"
            + "<td>"+tls+"</td>"
            + "</tr>"
            + "<tr>"
            + "<td style=\"width:10px;\">B</td>"
            + "<td style=\"width:60%;\">Total Leave Of Absence Without Pay (LWOP) in Years</td>"
            + "<td>"+lwop+"</td>"
            + "</tr>"
            + "<tr>"
            + "<td style=\"width:10px;\">C</td>"
            + "<td style=\"width:60%;\">Actual Length of Service</td>"
            + "<td>"+als+"</td>"
            + "</tr>"
            + "<tr>"
            + "<td style=\"width:10px;\">D</td>"
            + "<td style=\"width:60%;\">Actual Length of Period WITH Premium Payment (PPP)</td>"
            + "<td>"+rcs+"</td>"
            + "</tr>"
            + "<tr>"
            + "<td style=\"width:10px;\">E</td>"
            + "<td style=\"width:60%;\">Actual Length of Period WITHOUT Premium Payment</td>"
            + "<td>"+rcso+"</td>"                
            + "</tr>";

取得しているデータも調査しましたが、どの形式にもアンパサンド (&) はありませんでした。これにはとても戸惑いました。アンパサンド (&) があるかどうかもコードを検索しますが、何も見つかりませんでした。

これはSQLデータです

PARTNER,NAME_FIRST,NAMEMIDDLE,NAME_LAST,ZZSUFFIX,FULLNAME,AGENCY_NAME,AGENCY_ADDRESS,AGENCY

_BP_NUMBER,BDAY,BIRTHDATE,IDNO,CRN,POLICY_TYPE,MEM_ADDRESS,TOTAL_LENGTH_OF_SERVICE,INSOBJECT,POLICY_NUMBER,PERSONAL_SHARE,GOV_SHARE,EC_LIFE,PS_LIFE_INTEREST,GS_LIFE_INTEREST,PS_RET_INTEREST,GS_RET_INTEREST,EC_INTEREST,PROD_TYPE,DATA_LOAN_GRANTED,CONTRACT,GROSS,TOT_AMORT,TOT_REPAYMENT,OB_PRINCIPAL,INT_SUR,OB_TOT,LEAVE_WITHOUT_PAY,ACTUAL_LENGTH_OF_SERVICE,RCS,ACT_LNGTH_SRV_WITHOUT
'2000133249','NERA','A','GALAN',,'NERA A GALAN ','BICOL UNIV COLLEGE OF NURSING','LEGASPI CITY  ALBAY','1000000853','1969-03-25','March 25, 1969','69032501435','006000188531','COMPULSORY','PUROK 4 ROVER SUBD TUGOS CITY OF SORSOGON SORSOGON',,'00000010000003138060','CM00003730951',13170.24,17560.32,0.00,0.00,0.00,0.00,0.00,0.00,,,,,,,,,,0E-8,,0E-8,
4

1 に答える 1