打开iRXML时,iReport 5.6出现错误:“不允许在元素“样式"中出现“属性'hTextAlign'". [英] Got error at iReport 5.6 on opening JRXML: "Attribute 'hTextAlign' is not allowed to appear in element 'style'"

查看:93
本文介绍了打开iRXML时,iReport 5.6出现错误:“不允许在元素“样式"中出现“属性'hTextAlign'".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人试图打开 jrxml 文件时在 iReport 5.6 中遇到此错误吗?

Has anyone ever gotten this error in iReport 5.6 when trying to open the jrxml file?

属性"hTextAlign"不允许出现在元素样式"中

Attribute 'hTextAlign' is not allowed to appear in element 'style'

推荐答案

问题原因

jrxml 文件只是一个 xml 文件.在 XSD 模式.

The cause of problem

The jrxml file is just a xml file. It is a common practice to validate xml files with help of XSD schema.

JasperReports 引擎也在做同样的事情-使用 xsd 模式验证报告的模板( jrxml 文件).

The JasperReports engine is doing the same - it is using xsd schema to validate the report's template (jrxml file).

5.x 版本相比, xsd 版本在 6.x 版本中进行了更改.

The xsd was changed at 6.x version compared with 5.x version.

JasperReports 的最新版本的架构随 url .您始终可以在 jrxml 文件的标题中找到指向架构的链接:

The schema for latest version of JasperReports is available with url. You can always find the link to schema at header of jrxml file:

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport ... xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" ...>

看起来您的模板( jrxml 文件)是使用 6.x 版本的 JasperReports Studio 创建或编辑的,并且在保存时不应用与 5.x版本选项(兼容性警告"对话框).

Looks like your template (jrxml file) was created or edited with JasperReports Studio of 6.x version and saved without applying compatitbility with 5.x version option (Compatibility warning dialog).

  1. 您可以使用 Jaspersoft Studio ( JSS )修改报告的模板.也许这是最好的选择,因为 iReport 已被弃用(自2015年底以来不再受支持),并且仅支持 5.6和最旧的版本 JasperReports 模板/功能.

  1. You can use Jaspersoft Studio (JSS) for modifying report's template. Maybe it is the best choice because the iReport is deprecated (it is not supported since the end of 2015 year) and supports only 5.6 and oldest versions of JasperReports templates/features.

您可以在兼容模式下将模板另存为 JSS 5.x 版本,然后继续编辑 jrxml 文件与 iReport

You can save the template at compatitbility mode as 5.x version at JSS and after this continue edit the jrxml file with iReport

该对话框在保存模板期间显示在 JSS 上,如下所示:

The dialog appears during saving template at JSS and looks like this:

要启用此对话框,您应该在通过 Window->调用的窗体上更改设置.偏好设置菜单.

To enable this dialog you should change settings at form called via Window -> Preferences menu.

  1. 始终仅使用 iReport 设计器.但请注意:它不支持 JasperReports 模板的 6 + 版本.
  1. Always use only iReport designer. But be aware: it does not support 6+ version of JasperReports templates.

如何检查 5.x 6.x 版本的模式

任何版本的 JasperReports xsd 架构都可以在带有源代码的 JasperReports包中找到或在源代码的存储库中.

How to check the difference in schemas of 5.x and 6.x versions

The xsd schema for any version of JasperReports can be found at JasperReports package with source code or at repository of source code.

这是比较 5.6.1 (左图)和 6.3.0 (右图)的 xsd 文件的片段(屏幕截图) )版本.

This is a fragment (screenshot) of comparing xsd files of 5.6.1 (left panel) and 6.3.0 (right panel) versions.

您可以看到错误消息中的hTextAlign属性仅出现在 6.x 版本的 xsd 中.这是导致您出错的原因

As you can see that the hTextAlign attribute from your error message presents only at xsd of 6.x version. This is a cause of the error you got

这篇关于打开iRXML时,iReport 5.6出现错误:“不允许在元素“样式"中出现“属性'hTextAlign'".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆