This file is indexed.

/usr/lib/ruby/vendor_ruby/multi_xml/parsers/ox.rb is in ruby-multi-xml 0.5.4-0ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
require 'ox' unless defined?(Ox)

# Each MultiXml parser is expected to parse an XML document into a Hash. The
# conversion rules are:
#
# - Each document starts out as an empty Hash.
#
# - Reading an element created an entry in the parent Hash that has a key of
#   the element name and a value of a Hash with attributes as key value
#   pairs. Children are added as described by this rule.
#
# - Text and CDATE is stored in the parent element Hash with a key of
#   '__content__' and a value of the text itself.
#
# - If a key already exists in the Hash then the value associated with the key
#   is converted to an Array with the old and new value in it.
#
# - Other elements such as the xml prolog, doctype, and comments are ignored.
#

module MultiXml
  module Parsers
    module Ox #:nodoc:

      extend self

      def parse_error
        Exception
      end

      def parse(io)
        handler = Handler.new
        ::Ox.sax_parse(handler, io, :convert_special => true)
        handler.doc
      end

      class Handler
        attr_accessor :stack

        def initialize()
          @stack = []
        end

        def doc
          @stack[0]
        end

        def attr(name, value)
          unless @stack.empty?
            append(name, value)
          end
        end

        def text(value)
          append('__content__', value)
        end

        def cdata(value)
          append('__content__', value)
        end

        def start_element(name)
          if @stack.empty?
            @stack.push(Hash.new)
          end
          h = Hash.new
          append(name, h)
          @stack.push(h)
        end

        def end_element(name)
          @stack.pop()
        end

        def error(message, line, column)
          raise Exception.new("#{message} at #{line}:#{column}")
        end

        def append(key, value)
          key = key.to_s
          h = @stack.last
          if h.has_key?(key)
            v = h[key]
            if v.is_a?(Array)
              v << value
            else
              h[key] = [v, value]
            end
          else
            h[key] = value
          end
        end

      end # Handler
    end # Ox
  end # Parsers
end # MultiXml