Sha256: 238eeea972905695c9cff70d3a9bb2d5292121a199454c9e85acd0a9bfa92b12
Contents?: true
Size: 645 Bytes
Versions: 9
Compression:
Stored size: 645 Bytes
Contents
#!/usr/bin/env ruby -wW1 $: << '../lib' $: << '../ext' require 'stringio' require 'ox' class Sample < ::Ox::Sax def start_element(name); puts "start: #{name}"; end def end_element(name); puts "end: #{name}"; end def attr(name, value); puts " #{name} => #{value}"; end def text(value); puts "text #{value}"; end end io = StringIO.new(%{ <top name="sample"> <middle name="second"> <bottom name="third"/> </middle> </top> }) handler = Sample.new() Ox.sax_parse(handler, io) # outputs # start: top # name => sample # start: middle # name => second # start: bottom # name => third # end: bottom # end: middle # end: top
Version data entries
9 entries across 9 versions & 1 rubygems