Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
#!/usr/bin/env ruby |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
require 'rexml/document' |
| 5 |
require 'rexml/parsers/streamparser' |
| 6 |
require 'rexml/parsers/baseparser' |
| 7 |
require 'rexml/streamlistener' |
| 8 |
|
| 9 |
#REXML::Document.new(STDIN) |
| 10 |
|
| 11 |
class MyListener |
| 12 |
include REXML::StreamListener |
| 13 |
def tag_start(name, attrs) |
| 14 |
# p name, attrs |
| 15 |
case name |
| 16 |
when 'entry' |
| 17 |
@n = 0 |
| 18 |
end |
| 19 |
end |
| 20 |
def tag_end name |
| 21 |
# p "tag_end: #{x}" |
| 22 |
case name |
| 23 |
when 'sense' |
| 24 |
@n += 1 |
| 25 |
when 'entry' |
| 26 |
@n_ents += 1 |
| 27 |
puts "#{@ent}:#{@n}" if (@n > 8) |
| 28 |
when 'ent_seq' |
| 29 |
@ent = @text |
| 30 |
end |
| 31 |
end |
| 32 |
|
| 33 |
def text(text) |
| 34 |
@text = text |
| 35 |
end |
| 36 |
|
| 37 |
def xmldecl(version, encoding, standalone) |
| 38 |
@n_ents = 0 |
| 39 |
end |
| 40 |
end |
| 41 |
|
| 42 |
REXML::Parsers::StreamParser.new(STDIN, MyListener.new).parse |