Class: XmlToForm::XmlHandlersController
Instance Method Summary
collapse
Methods included from NokoHacks
#build_ds, #child_node_ds, #decode_node_path, #encode_node_path, #get_node_attribute_name, #iterate_child_nodes, #remove_blank_node, #update_xml, #update_xml_attributes
Instance Method Details
#upload_file ⇒ Object
15
16
|
# File 'app/controllers/xml_to_form/xml_handlers_controller.rb', line 15
def upload_file
end
|
18
19
20
|
# File 'app/controllers/xml_to_form/xml_handlers_controller.rb', line 18
def xml_form
@xml_data = XmlHandler.new(@attr_accessors)
end
|
#xml_update ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/xml_to_form/xml_handlers_controller.rb', line 22
def xml_update
@xml = XmlHandler.new(params[:xml_data])
params[:xml_handler].each do |key, value|
node = @xml_obj.at(decode_node_path(key))
update_xml(node, key, value)
if !node.content.empty? && !node.attributes.empty?
node.content = value
end
end
File.open('public/updated.xml', 'w') { |f| f.write(@xml_obj) }
send_file(File.join(Rails.root, 'public', 'updated.xml'))
end
|