[#4401] - XSD is not compliant with generated reports

Category:
Bug report
Priority:
High
Status:
Resolved
Project: Severity:
Major
Resolution:
Fixed
Component: Reproducibility:
Always
Assigned to:
0

Hello,

Version JasperStudio 6.0.3 and its libraries.

I used the studio to create a report with the last version (6.0.3). I got the following line in the JRXML File :
"<style name="Column header" forecolor="#666666" hTextAlign="Right" hImageAlign="Right" vTextAlign="Middle" vImageAlign="Middle" fontName="Arial" fontSize="11" isBold="true"/>"
When using library to compile a report generated by the studio and containing this line,I got error on a non existent hTextAlign or hImageAlign attribute in XML.
This is due to schema that seems not up to date on URL : http://jasperreports.sourceforge.net/xsd/jasperreport.xsd
the hTextAlign, vTextAlign, hImageAlign and vImageAlign are well described in schema reference : http://jasperreports.sourceforge.net/schema.reference.html
The solution is probably to update the jasperreport.xsd provided.

regards,

jphautin's picture
Joined: Apr 10 2015 - 1:14am
Last seen: 5 years 2 months ago

14 Comments:

#1
  • Status:New» Feedback Requested
  • Assigned:nobody» teodord

Hi,

If you compile the report created by JSS in a separate application that embeds JR Library, make sure that application uses the latest JR Library as well.
You cannot use old JR Library to compile newer JRXML, because the syntax has evolved.
If you don't want to upgrade JR Library, then you should make sure that you configure the JSS preferences to save JRXML in older format, that would match your app's JR version.

I hope this helps.
Teodor

#2

Hi,

Anything new on this one?

Thanks,
Teodor

#3
  • Resolution:Open» No Change Required
  • Status:Feedback Requested» Resolved
#4

I am having the same problem jphautin described: the file in http://jasperreports.sourceforge.net/xsd/jasperreport.xsd appears to be 6.0.0 - if you use a newer version of the library, xml file will complain about non existent attributes.

I guess the actual fix for this issue is the generated report source (jrxml) to point to a specific xsd file, not a generic one. Something like:

xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport-6.1.0.xsd"

instead of

xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"

the solution is to qualify the version of XSD (and upload it to http://jasperreports.sourceforge.net/xsd/)

#5
  • Resolution:No Change Required» Reopened
  • Status:Resolved» Feedback Requested

change status?

#6

Could you please detail the "xml file will complain about non existent attributes". Where exactly does that happen?

When JasperReports loads an JRXML file, it uses an internal XSD file and not the public http://jasperreports.sourceforge.net/xsd/jasperreport.xsd

Regards,
Lucian

#7

The problem really is not in using the report, but if the JRXML file is used inside an IDE (Ex: Eclipse) it will flag errors in xml file about non existent attributes (because eclipse only knows about the public xsd). In fact the report works fine, but it is annoying to see eclipse reporting errors in the file. Since jasper reports studio is based on Eclipse, maybe this affect studio too, but i cant say for sure.

#8

I updated the XSD files on http://jasperreports.sourceforge.net/xsd with the schema files that correspond to the latest release (6.1.0).

We'll consider qualifying the XSD files with release names. That's not strictly required because we keep the schema backward compatible, so as long as we have the latest schema on sourceforge.net it would validate JRXML files produced by any JR version. But having separate schemas per versions might play a role in the compatibility mode in JSS. We'll have to think whether it would help there.

#9

Thanks, the issue is solved.

#10

I have the same issue when trying to create a jrtx file using Jaspersoft Studio. I'm using a 6.0.x version of Studio which has been upgraded using the Eclipse tools to 6.1.final.

When I add hTextAlign="Right" somewhere, I get the error:

Save Failed
Attribute "hTextAlign" must be declared for element type "style".

However there is no problem adding the same style directly to a report. Is there an XSD for the jasperTemplate element hidden somewhere inside the application?

The full exception is:

Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 53; Attribute "hTextAlign" must be declared for element type "style".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(XMLDTDValidator.java:1253)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1917)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:763)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
at org.apache.commons.digester.Digester.parse(Digester.java:1916)
at net.sf.jasperreports.engine.xml.JRXmlTemplateLoader.loadTemplate(JRXmlTemplateLoader.java:207)
... 67 more

#11
  • Resolution:Reopened» Fixed
  • Status:Feedback Requested» Resolved

Hi,

I have updated the jaspertemplate.dtd file on the website as well.

Thanks,
Teodor

#12

I updated my studio to 6.1.0 final today (using Eclipse's update).

It is still not possible to open a style template having hTextAlign or vTextAlign.

The only difference with 6.0.4 I see is that there is now a NullPointException when displaying the Style tab in the style template editor.
See attachment.

I tried to uninstall jasper studio feature (from Eclipse) and reinstall it, same result. And now there is no way to go back to previous version that was working better. I am not happy that I updated it.

The standalone version is working similarly even with a fresh new workspace.

Environment:
- Java 1.8.0_40
- Debian 7.8

AttachmentSize
Plain text icon jasper_studio_problem_styles.txt5.05 KB
#13

Hi, the studio bug was fixed and you will find the fix in the next version

#14

Hi!

When would the next version be released? :c

Feedback
randomness