class SiSU_Rexml::Rexml
Public Class Methods
new(md,fno)
click to toggle source
# File lib/sisu/rexml.rb, line 76 def initialize(md,fno) @md,@fno=md,fno @env=SiSU_Env::InfoEnv.new(@md.fns) @prog=SiSU_Env::InfoProgram.new #(md.fns) #if md if File.file?(@fno) @fnap=@fno #index.xml causes problems with index.html in server config end @e_head='/document/head' @e_title='/document/head/title' @e_object='/document/body/object' @e_ocn='/document/body/object/ocn' @e_text='/document/body/object/text' @e_endnote='/document/body/object/endnote' end
Public Instance Methods
xml()
click to toggle source
# File lib/sisu/rexml.rb, line 90 def xml begin if FileTest.file?(@fnap) if @prog.rexml !=false \ and FileTest.directory?('/usr/lib/ruby/1.8/rexml/') #note values can be other than true xmlfile=IO.readlines(@fnap,'').join begin @xmldoc=REXML::Document.new xmlfile SiSU_Screen::Ansi.new( @md.opt.act[:color_state][:set], 'invert', 'REXML', "XML document #{@fnap} loaded" ).colorize unless @md.opt.act[:quiet][:set]==:on if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on) @xmldoc.elements.each(@e_head) do |e| SiSU_Screen::Ansi.new( @md.opt.act[:color_state][:set], 'brown', e ).colorize unless @md.opt.act[:quiet][:set]==:on end end rescue REXML::ParseException puts 'broken XML' end end else SiSU_Screen::Ansi.new( @md.opt.act[:color_state][:set], 'fuchsia', "File Not Found #{xmlfile}", 'requested XML processing skipped' ).colorize unless @md.opt.act[:quiet][:set]==:on exit end rescue SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do __LINE__.to_s + ':' + __FILE__ end ensure end end