Source

hello / ruby / test.rb

Full commit
#!/usr/bin/env ruby


require 'rexml/rexml'
require 'rexml/document'
require 'rexml/parsers/treeparser'

# REXML::Parsers

ARGV.each do | file |
#    dom = REXML::Parsers::TreeParser.new  file #, doc  
#    dom.write
#    doc = dom.parse
#    p build_context
#    doc = REXML::Document.new file
#    doc = REXML::SourceFactory::create_from File.open(file)
    dom = REXML::Document.new File::open(file)
#    p dom
#    p doc
#    dom.write
#    print dom.root
#    dom2 = dom.root.clone
#    dom.add dom2.root.first
#    print dom.unshift
    text = REXML::Text.new "gaho"
    dom.root.each do | n |
      n.add text if n.parent?
    end
    print dom
end