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