module QuiversTaskrunner::XmlHelper
Public Class Methods
create_xmlnode(name, original_document, attributes={}, content={})
click to toggle source
# File lib/quiverstaskrunner/helpers/xmlhelper.rb, line 44 def self.create_xmlnode(name, original_document, attributes={}, content={}) node = Nokogiri::XML::Node.new name, original_document unless attributes.nil? || attributes.empty? attributes.each { |k,v| node[k.to_s] = v } end unless content.nil? || content.empty? node.content = content end return node end
get_xml(filepath)
click to toggle source
# File lib/quiverstaskrunner/helpers/xmlhelper.rb, line 30 def self.get_xml(filepath) xml = nil File.open(filepath, "rb") do |f| xml = Nokogiri::XML(f) end return xml end
overide_xml(filepath, xml)
click to toggle source
# File lib/quiverstaskrunner/helpers/xmlhelper.rb, line 38 def self.overide_xml(filepath, xml) File.open(filepath, "w") do |f| f.write(xml.to_xml) end end