XML验证:从元素'jr:table'开始发现无效内容

时间:2015-06-15 05:30:11

标签: jsp jasper-reports xml-validation

我使用iReport-5.6.0开发了PDF报告。在iReport中一切正常。我在Eclipse中创建了.jsp文件。当我尝试在Eclipse中运行该程序时,我得到以下异常:

  

SEVERE:第130行第227列的解析错误:cvc-complex-type.2.4.a:找到以元素'jr:table'开头的无效内容。其中一个是{{http://jasperreports.sourceforge.net/jasperreports“:component}'。

请帮帮我。提前谢谢。

pdf1.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%@page import="net.sf.jasperreports.engine.design.JRDesignQuery"%>
<%@page import="net.sf.jasperreports.engine.xml.JRXmlLoader"%>
<%@page import="net.sf.jasperreports.engine.design.JasperDesign"%>
<%@page import="net.sf.jasperreports.view.JasperViewer"%>
<%@ page import="net.sf.jasperreports.engine.*" %>
<%@ page import="java.io.File"%>
<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.io.FileNotFoundException" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.sql.Connection"%>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.SQLException"%>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
<title>Insert title here</title>
</head>
<body>
<%
Connection conn=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.2:1521:orcl", "username",
  "password");

String report="C:\\Users\\admin\\attendance.jrxml";

JasperReport jasperreport=JasperCompileManager.compileReport(report);
JasperPrint jp=JasperFillManager.fillReport(jasperreport, null,conn);
JasperViewer.viewReport(jp);

}
catch(Exception e)
{
out.println(e);
}

%>
</body>
</html>

attendance.jrxml:

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="attendance" language="groovy" pageWidth="1224" pageHeight="595" orientation="Landscape" columnWidth="1184" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
  <property name="ireport.zoom" value="1.0"/>
  <property name="ireport.x" value="0"/>
  <property name="ireport.y" value="0"/>
  <style name="table">
  <box>
  <pen lineWidth="1.0" lineColor="#000000"/>
  </box>
  </style>
  <style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
  <box>
  <pen lineWidth="0.5" lineColor="#000000"/>
  </box>
  </style>
  <style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
  <box>
  <pen lineWidth="0.5" lineColor="#000000"/>
  </box>
  </style>
  <style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
  <box>
  <pen lineWidth="0.5" lineColor="#000000"/>
  </box>
  <conditionalStyle>
  <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
  <style backcolor="#EFF7FF"/>
  </conditionalStyle>
  </style>
  <style name="table 1">
  <box>
  <pen lineWidth="1.0" lineColor="#000000"/>
  </box>
  </style>
  <style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
  <box>
  <pen lineWidth="0.5" lineColor="#000000"/>
  </box>
  </style>
  <style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
  <box>
  <pen lineWidth="0.5" lineColor="#000000"/>
  </box>
  </style>
  <style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
  <box>
  <pen lineWidth="0.5" lineColor="#000000"/>
  </box>
  <conditionalStyle>
  <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
  <style backcolor="#EFF7FF"/>
  </conditionalStyle>
  </style>
  <style name="table 2">
  <box>
  <pen lineWidth="1.0" lineColor="#000000"/>
  </box>
  </style>
  <style name="table 2_TH" mode="Opaque" backcolor="#F0F8FF">
  <box>
  <pen lineWidth="0.5" lineColor="#000000"/>
  </box>
  </style>
  <style name="table 2_CH" mode="Opaque" backcolor="#BFE1FF">
  <box>
  <pen lineWidth="0.5" lineColor="#000000"/>
  </box>
  </style>
  <style name="table 2_TD" mode="Opaque" backcolor="#FFFFFF">
  <box>
  <pen lineWidth="0.5" lineColor="#000000"/>
  </box>
  <conditionalStyle>
  <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
  <style backcolor="#EFF7FF"/>
  </conditionalStyle>
  </style>
  <subDataset name="New Dataset 1" >
  <queryString language="SQL">
  <![CDATA[select empcode,empname, punchdate,login, brkout, brkin,logout,  round((to_date(login ,'HH24:MI')-to_date(starttime,'HH24:MI')) * 24 * 60)late,  round((to_date(endtime,'HH24:MI')-to_date(logout,'HH24:MI')) * 24 * 60) early, round((to_date(brkin,'HH24:MI')-to_date(brkout,'HH24:MI')) * 24 * 60) brk,round(( decode( to_date(login , 'HH24:MI') - to_date (brkout , 'HH24:MI') , '' ,0,to_date(brkout , 'HH24:MI') - to_date (login , 'HH24:MI') )  + decode( to_date(logout , 'HH24:MI') - to_date (brkin , 'HH24:MI'), '',0,  to_date(logout , 'HH24:MI') - to_date (brkin , 'HH24:MI') ) ) * 24 ) tothrs,uniform,remarks from ( select a.empcode,b.empname,a.punchdate,  to_char( min (case when a.status ='IN' then a.punchtime ELSE null END) , 'HH24:MI' ) login,  to_char( ( case when ( min (case when a.status ='IN' then a.punchtime  ELSE null END)) =   ( max (case when a.status ='IN' then a.punchtime  ELSE null END)) then  null else max (case when a.status ='IN' then a.punchtime  ELSE null END)  end ),'HH24:MI' ) brkin,  to_char( min (case when a.status ='OUT' then a.punchtime  ELSE null END) , 'HH24:MI' ) brkout,to_char( ( case when ( min (case when a.status ='OUT' then a.punchtime  ELSE null END)) =  ( max (case when a.status ='OUT' then a.punchtime  ELSE null END)) then  null else max (case when a.status ='OUT' then a.punchtime  ELSE null END)end ),'HH24:MI' ) logout, to_char( c.starttime ,'HH24:MI') starttime ,  to_char( c.endtime ,'HH24:MI') endtime,a.uniform,a.remarks from peco.memployeetrack a,peco.memployee b, peco.mshift c  Where a.punchdate  = '01-Oct-2014'  and a.empcode=b.empcode and b.shiftcode=c.shiftcode group by a.empcode,b.empname,a.punchdate,c.starttime,c.endtime,a.uniform,a.remarks )  union all select empcode,empname, null aspunchdate, '' login , '' brkout, '' brkin, '' logout, 0late,  0 early , 0 brk , 0 tothrs,'','' from peco.memployee    where empcode not in  (select EMPCODE from peco.MEMPLOYEETRACK where punchdate = '01-Oct-2014'  and ourbranchcode = 'HO')   and ourbranchcode='HO'  and isactive=0 and empcode <> 'NONE' order by punchdate , empname]]>
  </queryString>
  <field name="EMPCODE" class="java.lang.String"/>
  <field name="EMPNAME" class="java.lang.String"/>
  <field name="PUNCHDATE" class="java.sql.Timestamp"/>
  <field name="LOGIN" class="java.lang.String"/>
  <field name="BRKOUT" class="java.lang.String"/>
  <field name="BRKIN" class="java.lang.String"/>
  <field name="LOGOUT" class="java.lang.String"/>
  <field name="LATE" class="java.math.BigDecimal"/>
  <field name="EARLY" class="java.math.BigDecimal"/>
  <field name="BRK" class="java.math.BigDecimal"/>
  <field name="TOTHRS" class="java.math.BigDecimal"/>
  <field name="UNIFORM" class="java.lang.String"/>
  <field name="REMARKS" class="java.lang.String"/>
  </subDataset>
  <queryString>
  <![CDATA[select empcode,empname, punchdate,login, brkout, brkin,logout,  round((to_date(login ,'HH24:MI')-to_date(starttime,'HH24:MI')) * 24 * 60)late,  round((to_date(endtime,'HH24:MI')-to_date(logout,'HH24:MI')) * 24 * 60) early, round((to_date(brkin,'HH24:MI')-to_date(brkout,'HH24:MI')) * 24 * 60) brk,round(( decode( to_date(login , 'HH24:MI') - to_date (brkout , 'HH24:MI') , '' ,0,to_date(brkout , 'HH24:MI') - to_date (login , 'HH24:MI') )  + decode( to_date(logout , 'HH24:MI') - to_date (brkin , 'HH24:MI'), '',0,  to_date(logout , 'HH24:MI') - to_date (brkin , 'HH24:MI') ) ) * 24 ) tothrs,uniform,remarks from ( select a.empcode,b.empname,a.punchdate,  to_char( min (case when a.status ='IN' then a.punchtime ELSE null END) , 'HH24:MI' ) login,  to_char( ( case when ( min (case when a.status ='IN' then a.punchtime  ELSE null END)) =   ( max (case when a.status ='IN' then a.punchtime  ELSE null END)) then  null else max (case when a.status ='IN' then a.punchtime  ELSE null END)  end ),'HH24:MI' ) brkin,  to_char( min (case when a.status ='OUT' then a.punchtime  ELSE null END) , 'HH24:MI' ) brkout,to_char( ( case when ( min (case when a.status ='OUT' then a.punchtime  ELSE null END)) =  ( max (case when a.status ='OUT' then a.punchtime  ELSE null END)) then  null else max (case when a.status ='OUT' then a.punchtime  ELSE null END)end ),'HH24:MI' ) logout, to_char( c.starttime ,'HH24:MI') starttime ,  to_char( c.endtime ,'HH24:MI') endtime,a.uniform,a.remarks from peco.memployeetrack a,peco.memployee b, peco.mshift c  Where a.punchdate  = '01-Oct-2014'  and a.empcode=b.empcode and b.shiftcode=c.shiftcode group by a.empcode,b.empname,a.punchdate,c.starttime,c.endtime,a.uniform,a.remarks )  union all select empcode,empname, null aspunchdate, '' login , '' brkout, '' brkin, '' logout, 0late,  0 early , 0 brk , 0 tothrs,'','' from peco.memployee    where empcode not in  (select EMPCODE from peco.MEMPLOYEETRACK where punchdate = '01-Oct-2014'  and ourbranchcode = 'HO')   and ourbranchcode='HO'  and isactive=0 and empcode <> 'NONE' order by punchdate , empname]]>
  </queryString>
  <field name="EMPCODE" class="java.lang.String"/>
  <field name="EMPNAME" class="java.lang.String"/>
  <field name="PUNCHDATE" class="java.sql.Timestamp"/>
  <field name="LOGIN" class="java.lang.String"/>
  <field name="BRKOUT" class="java.lang.String"/>
  <field name="BRKIN" class="java.lang.String"/>
  <field name="LOGOUT" class="java.lang.String"/>
  <field name="LATE" class="java.math.BigDecimal"/>
  <field name="EARLY" class="java.math.BigDecimal"/>
  <field name="BRK" class="java.math.BigDecimal"/>
  <field name="TOTHRS" class="java.math.BigDecimal"/>
  <field name="UNIFORM" class="java.lang.String"/>
  <field name="REMARKS" class="java.lang.String"/>
  <background>
  <band splitType="Stretch"/>
  </background>
  <title>
  <band height="79" splitType="Stretch"/>
  </title>
  <pageHeader>
  <band height="35" splitType="Stretch"/>
  </pageHeader>
  <columnHeader>
  <band height="50" splitType="Stretch"/>
  </columnHeader>
  <detail>
  <band height="14" splitType="Stretch">
  <componentElement>
  <reportElement key="table 2" style="table 2" x="0" y="0" width="844" height="14" >
  <printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
  </reportElement>
  <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
  <datasetRun subDataset="New Dataset 1" >
  <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
  </datasetRun>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[EMPCODE]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{EMPCODE}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[EMPNAME]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{EMPNAME}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[PUNCHDATE]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{PUNCHDATE}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[LOGIN]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{LOGIN}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[BRKOUT]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{BRKOUT}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[BRKIN]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{BRKIN}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[LOGOUT]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{LOGOUT}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[LATE]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{LATE}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[EARLY]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{EARLY}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[BRK]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{BRK}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[TOTHRS]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{TOTHRS}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30" />
  <text><![CDATA[UNIFORM]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20" />
  <textFieldExpression><![CDATA[$F{UNIFORM}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  <jr:column width="90" >
  <jr:columnHeader style="table 2_CH" height="30">
  <staticText>
  <reportElement x="0" y="0" width="90" height="30"/>
  <text><![CDATA[REMARKS]]></text>
  </staticText>
  </jr:columnHeader>
  <jr:columnFooter style="table 2_CH" height="30"/>
  <jr:detailCell style="table 2_TD" height="20">
  <textField isStretchWithOverflow="true" isBlankWhenNull="true">
  <reportElement x="0" y="0" width="90" height="20"/>
  <textFieldExpression><![CDATA[$F{REMARKS}]]></textFieldExpression>
  </textField>
  </jr:detailCell>
  </jr:column>
  </jr:table>
  </componentElement>
  </band>
  </detail>
</jasperReport>

0 个答案:

没有答案