Thread: Re: PostgreSQL 9.3 XML parser seems not to recognize the DOCTYPE element in XML files
Re: PostgreSQL 9.3 XML parser seems not to recognize the DOCTYPE element in XML files
I have this table:
CREATE TABLE REPORT_STYLE (
REPORT_STYLE_NAME VARCHAR(75) NOT NULL,
REPORT_STYLE_VERSION NUMERIC(8,0) NOT NULL,
UPDATE_TS TIMESTAMP NOT NULL,
UPDATE_USER_NAME VARCHAR(30) NOT NULL,
STYLE_DESCR VARCHAR(200),
JASPER_STYLE XML
);
ALTER TABLE REPORT_STYLE ADD CONSTRAINT PK_RPTSTY PRIMARY KEY (REPORT_STYLE_NAME);
And this document (notice the <!DOCTYPE):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperTemplate PUBLIC "-//JasperReports//DTD Template//EN" "http://jasperreports.sourceforge.net/dtds/jaspertemplate.dtd">
<jasperTemplate>
<style name="LabelPlainSmall" forecolor="#000000" backcolor="#FFFFFF" fontSize="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="TextBoxDefault" forecolor="#000000" backcolor="#FFFFFF" isBlankWhenNull="true" fontSize="9"/>
<style name="ScheduleTitle" forecolor="#000000" backcolor="#FFFFFF" fontSize="14" isBold="true"/>
<style name="CheckBox" forecolor="#000000" backcolor="#FFFFFF" hAlign="Center" vAlign="Middle" isBlankWhenNull="true" fontSize="8">
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
</style>
<style name="LabelBoldSmall" forecolor="#000000" backcolor="#FFFFFF" fontSize="7" isBold="true"/>
<style name="ScheduleName" forecolor="#000000" backcolor="#FFFFFF" fontSize="10" isBold="true"/>
<style name="LabelDefault" forecolor="#000000" backcolor="#FFFFFF" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="LabelBoldMedium" forecolor="#000000" backcolor="#FFFFFF" fontSize="8" isBold="true"/>
<style name="LabelPlainLarge" forecolor="#000000" backcolor="#FFFFFF" fontSize="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="LabelBoldLarge" forecolor="#000000" backcolor="#FFFFFF" fontSize="10" isBold="true"/>
<style name="NumberDefault" forecolor="#000000" backcolor="#FFFFFF" fontSize="9" isBold="true"/>
<style name="LabelPlainExtraSmall" forecolor="#000000" backcolor="#FFFFFF" fontSize="6" isBold="false"/>
<style name="LabelBoldExtraSmall" forecolor="#000000" backcolor="#FFFFFF" fontSize="6" isBold="true"/>
<style name="Header" forecolor="#000000" backcolor="#FFFFFF" fontSize="9"/>
<style name="Footer" forecolor="#000000" backcolor="#FFFFFF" fontSize="9"/>
<style name="CoverSheetName" forecolor="#000000" backcolor="#FFFFFF" isBlankWhenNull="true" fontSize="12" isBold="true"/>
<style name="SmallCheckBox" forecolor="#000000" backcolor="#FFFFFF">
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
</style>
</jasperTemplate>
When I try this update:
UPDATE REPORT_STYLE SET JASPER_STYLE = XMLPARSE(DOCUMENT ?) WHERE (REPORT_STYLE_NAME = ?)
I get:
org.postgresql.util.PSQLException: ERROR: invalid XML content
Detail: line 2: StartTag: invalid element name
<!DOCTYPE jasperTemplate PUBLIC "-//JasperReports//DTD Template//EN" "http://jas
^
I AM using ‘XMLPARSE(DOCUMENT’. Why the error?
Using PG 9.3 with this JDBC driver:
10:37:51,822 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-11) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.2)
Re: Re: PostgreSQL 9.3 XML parser seems not to recognize the DOCTYPE element in XML files
On 5/29/14, 11:59 AM, Bob Moyers wrote: > When I try this update: > > UPDATE REPORT_STYLE SET JASPER_STYLE = XMLPARSE(DOCUMENT ?) WHERE > (REPORT_STYLE_NAME = ?) > > > > I get: > > org.postgresql.util.PSQLException: ERROR: invalid XML content > > Detail: line 2: StartTag: invalid element name > > <!DOCTYPE jasperTemplate PUBLIC "-//JasperReports//DTD Template//EN" > "http://jas This could be a problem with the JDBC driver's handling of xmlparse. Maybe you could help some debugging help on their mailing list. Also check the server log. Maybe you can see there what the server actually received.
Re: PostgreSQL 9.3 XML parser seems not to recognize the DOCTYPE element in XML files
Peter Eisentraut-2 wrote > On 5/29/14, 11:59 AM, Bob Moyers wrote: >> When I try this update: >> >> UPDATE REPORT_STYLE SET JASPER_STYLE = XMLPARSE(DOCUMENT ?) WHERE >> (REPORT_STYLE_NAME = ?) >> >> >> >> I get: >> >> org.postgresql.util.PSQLException: ERROR: invalid XML content >> >> Detail: line 2: StartTag: invalid element name >> >> <!DOCTYPE jasperTemplate PUBLIC "-//JasperReports//DTD >> Template//EN" > > "http://jas > > This could be a problem with the JDBC driver's handling of xmlparse. > Maybe you could help some debugging help on their mailing list. Also > check the server log. Maybe you can see there what the server actually > received. So I tested a "SELECT XMLPARSE(DOCUMENT ?)" query using the 9.0-801 driver against a 9.0 server and did not encounter the parsing error described. It would help to show the actual Java code you are using, especially the parameter setValue calls, as I am guessing that the unknown typed first parameter is being immediately cast to "xml" - before being fed to XMLPARSE. If that is the case then the server's default of CONTENT would be in effect and you would get the error in question. You must ensure you pass in a string for the first parameter. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Re-PostgreSQL-9-3-XML-parser-seems-not-to-recognize-the-DOCTYPE-element-in-XML-files-tp5805492p5806063.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.