Sha256: 352e6c94fc991fa3ded243c2d4cb68f522633992afe13c5dd9e957d9dd8de9ab
Contents?: true
Size: 957 Bytes
Versions: 1
Compression:
Stored size: 957 Bytes
Contents
class Birt::RptDesign #design文件路径 attr_accessor :rpt_design_path attr_accessor :data_sources attr_accessor :data_sets def initialize(rpt_design_path) self.rpt_design_path = rpt_design_path self.data_sources = Hash.new self.data_sets = Hash.new end #解析文件 def parse_rpt _root = REXML::Document.new(File.read(self.rpt_design_path)).root #数据源 _root.each_element(xpath = '/report/data-sources/oda-data-source') do |item| self.data_sources[item.attribute(:name).value] = Birt::DataSource.new(item) end #数据集 _root.each_element(xpath='/report/data-sets/oda-data-set') do |item| self.data_sets[item.attribute(:name).value] = Birt::DataSet.new(item) do |data_set| data_set.data_source = self.data_sources[item.get_elements("property[@name='dataSource']")[0].text] data_set.query end end p self.data_sources p self.data_sets end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
birt-0.1.1 | lib/birt/rpt_design.rb |