14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/xeroizer/report/row/xml_helper.rb', line 14
def build_from_node(node, report, parent = nil)
row_type = node.xpath('RowType').first.text
row = nil
case row_type
when 'Header'
row = HeaderRow.new(report);
parent. = row if parent
report. ||= row
when 'Section'
row = SectionRow.new(report)
row. = report.
report.sections << row
when 'SummaryRow'
row = SummaryRow.new(report);
row. = report.
if parent
parent.summary = row
if parent.title.to_s == '' && report.summary.nil?
report.summary = row
end
else
report.summary = row
end
else
row = Row.new(report)
row. = report.
end
row.parent = parent
node.elements.each do | element |
case element.name.to_s
when 'RowType' then row.type = element.text
when 'Title' then row.title = element.text
when 'Rows'
element.elements.each do | row_node |
row.rows << Row.build_from_node(row_node, report, row)
end
when 'Cells'
element.elements.each do | cell_node |
row.cells << Cell.build_from_node(cell_node)
end
end
end
row
end
|