将Oracle报表(.rdf)转换为BIRT报表 [英] Converting Oracle Reports (.rdf) to BIRT reports
问题描述
我有一些正在考虑转换为BIRT报告的Oracle报告(.rdf).有没有一种方法可以将.rdf文件转换为BIRT报表设计文件?
I have some Oracle Reports (.rdf) that I am considering converting to BIRT reports. Is there a way to convert .rdf files to BIRT report design files?
推荐答案
全自动解决方案可能是不可能的.您可以按如下所示部分自动化转换过程:
A fully automated solution is probably not possible. You can partially automate the conversion process as follows:
- 将RDF文件转换为XML.
- 提取报告查询.
- 使用XSLT将XML转换为BIRT(或JRXML).
XML转换
使用Cygwin的第一步非常简单:
XML Conversion
The first step is fairly simple, using Cygwin:
cd /path/to/reports/
mkdir xml
for i in *.rdf; do
rwconverter.exe batch=yes source="$i" dest=xml/"$i".xml dtype=xmlfile \
userid=scott/tiger@xe
done
提取
第二步也相对容易,使用 starlet (将xml.exe
重命名为starlet.exe
以避免与Oracle的xml.exe
冲突):
Extraction
The second step is also relatively easy, using starlet (rename xml.exe
to starlet.exe
to avoid conflicts with Oracle's xml.exe
):
starlet.exe sel -t -v "/report/data/dataSource/select" filename.rdf.xml
您也可以使用xmllint,但是它包含select
和CDATA
元素,您必须分别对其进行解析:
You can also use xmllint, but it includes the select
and CDATA
elements, which you'd have to parse separately:
xmllint --xpath /report/data/dataSource/select filename.rdf.xml
格式转换
第三步很有挑战性.创建一个读取RDF布局的XSL模板(例如<displayInfo x="0.74377" y="0.97913" width="1.29626" height="1.62695" />
).然后将这些布局转换为目标报表引擎所使用的相应格式(例如BIRT或JasperReports).
Format Conversion
The third step is challenging. Create an XSL template that reads the RDF layouts (e.g., <displayInfo x="0.74377" y="0.97913" width="1.29626" height="1.62695" />
). Then convert those layouts to the corresponding format used by the destination report engine (such as BIRT or JasperReports).
您不会获得100%的解决方案,但是80%的解决方案可以显着减少转换报表所需的单调且容易出错的工作量.
You wouldn't get a 100% solution, but an 80% solution could significantly reduce the amount of monotonous, error-prone work required to convert the reports.
这篇关于将Oracle报表(.rdf)转换为BIRT报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!