java - ERROR: 'The entity name must immediately follow the '&' in the entity reference.' -


hi getting error when converting html pdf here 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 , 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 summary of premium , loan account balances on record gsis of "+ dateformat.format(date) +"."             + " view more updated summary , detailed account balances, can go "             + "<span style=\"color: #0000ff; font-style: italic; text-decoration: underline;\">www.gsis.gov.ph</span> , log-on egsismo."             + "</p>"             + "<p>in case of discrepancy, please coordinate personnel/accounting office facilitate reconciliation of record"             + "and accounts 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 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 total number of years, months, days in government service.</p>"             + "<p>b. total leave of absence without pay (lwop) period of time no actual service rendered "             + "and paid. such, premium payment said period of time not required. in case, period not "             + "considered in computation of total length of service.</p>"             + "<p>c. actual length of service total length of service less total leave of absence without pay</p>"             + "<p>d. actual length of service posted premium payment (ppp) number of years in service"             + " wherein correct premium payments have been paid , posted.</p>"             + "<p>e. actual length of service without posted premium payment (ppp) number of years in service "             + "that not have premium payments. subject reconciliation member , agency record.</p>"             + "<p>f. equivalent salary based on posted premium payment salary had paid premium payment. "             + "salary used in computation of gross loan amount.</p>"             + "</body>"             + "</html>"; 

yeah more of wordings. can't find & in whole html code. error coming?:

 error:  'the entity name must follow '&' in entity reference.' org.xhtmlrenderer.util.xrruntimeexception: can't load xml resource (using trax transformer). org.xml.sax.saxparseexception: entity name must follow '&' in 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 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>"; 

i investigated data getting , there no ampersand(&) in form. puzzled this. search through code if there ampersand(&) found nothing.

this sql data

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 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, 

it's quite possibly in var1, var2, var3 or var4. (for example, might business name of "smith & jones". don't know what's in variables given overly-generic names, of course.)

this why should build xml using xml api, can perform appropriate escaping you. it's fundamentally same mistake using string concatenation build sql statement including user input instead of using parameterized sql - it's in different form.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -