1class Listener 2 attr_reader :ts, :te 3 attr_reader :normalize 4 def initialize 5 @ts = false 6 @te = false 7 end 8 def tag_start name, attrs 9 @ts = true if name=="subsection" and attrs["title"]=="Namespaces" 10 end 11 def tag_end name 12 @te = true if name=="documentation" 13 end 14 def text text 15 @normalize = text 16 #text.tr! "\n", ' ' 17 #puts "text #{text[0..10]}..." 18 end 19 def instruction name, instruction 20 #puts "instruction" 21 end 22 def comment comment 23 #puts "comment #{comment[0..10]}..." 24 end 25 def doctype name, pub_sys, long_name, uri 26 #puts "doctype #{name}" 27 end 28 def attlistdecl content 29 #puts "attlistdecl" 30 end 31 def elementdecl content 32 #puts "elementdecl" 33 end 34 def entitydecl content 35 #puts "entitydecl" 36 end 37 def notationdecl content 38 #puts "notationdecl" 39 end 40 def entity content 41 #puts "entity" 42 end 43 def cdata content 44 #puts "cdata" 45 end 46 def xmldecl version, encoding, standalone 47 #puts "xmldecl #{version}" 48 end 49end 50 51