module AXML::REXMLAbstraction
Public Class Methods
xml_as_document(xml)
click to toggle source
# File lib/axml.rb, line 14 def self.xml_as_document(xml) if xml.is_a?(String) xml_clean = xml.chomp.strip.chomp unless xml_clean.start_with?('<') file_name = File.expand_path(xml) xml_document = REXML::Document.new(File.new(file_name)) if !file_name.start_with?('<') and File.exists?(file_name) end xml_document ||= REXML::Document.new(xml) else xml_document = xml end xml_document end