This file is indexed.

/usr/lib/ruby/1.9.1/htree/rexml.rb is in libhtree-ruby1.9.1 0.7-5.

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
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# = REXML Tree Generator
#
# HTree::Node#to_rexml is used for converting HTree to REXML.
#
# == Method Summary
#
# - HTree::Node#to_rexml -> REXML::Child
#
# == Example
#
#   HTree.parse(...).to_rexml #=> REXML::Document
#
# == Comparison between HTree and REXML.
#
# - HTree parser is permissive HTML/XML parser.
#   REXML parser is strict XML parser.
#   HTree is recommended if you need to parse realworld HTML.
#   REXML is recommended if you need strict error checking.
# - HTree object is immutable.
#   REXML object is mutable.
#   REXML should be used if you need modification.
#
require 'htree/modules'
require 'htree/output' # HTree::DocType#generate_content

module HTree
  module Node
    # convert to REXML tree.
    def to_rexml
      require 'rexml/document'
      to_rexml_internal(nil, DefaultContext)
    end
  end

  # :stopdoc:

  class Doc
    def to_rexml_internal(parent, context)
      raise ArgumentError, "parent must be nil" if parent != nil
      result = REXML::Document.new
      self.children.each {|c|
        c.to_rexml_internal(result, context)
      }
      result
    end
  end

  class Elem
    def to_rexml_internal(parent, context)
      ename = self.element_name
      ns_decl = {}
      if context.namespace_uri(ename.namespace_prefix) != ename.namespace_uri
        ns_decl[ename.namespace_prefix] = ename.namespace_uri
      end

      if ename.namespace_prefix
        result = REXML::Element.new("#{ename.namespace_prefix}:#{ename.local_name}", parent)
      else
        result = REXML::Element.new(ename.local_name, parent)
      end

      self.each_attribute {|aname, atext|
        if aname.namespace_prefix
          if context.namespace_uri(aname.namespace_prefix) != aname.namespace_uri
            ns_decl[aname.namespace_prefix] = aname.namespace_uri
          end
          result.add_attribute("#{aname.namespace_prefix}:#{aname.local_name}", atext.to_s)
        else
          result.add_attribute(aname.local_name, atext.to_s)
        end
      }

      ns_decl.each {|k, v|
        if k
          result.add_namespace(k, v)
        else
          result.add_namespace(v)
        end
      }
      context = context.subst_namespaces(ns_decl)

      self.children.each {|c|
        c.to_rexml_internal(result, context)
      }
      result
    end
  end

  class Text
    def to_rexml_internal(parent, context)
      rcdata = self.rcdata.gsub(/[<>]/) { Encoder::ChRef[$&] }
      REXML::Text.new(rcdata, true, parent, true)
    end
  end

  class XMLDecl
    def to_rexml_internal(parent, context)
      r = REXML::XMLDecl.new(self.version, self.encoding, self.standalone)
      parent << r if parent
      r
    end
  end

  class DocType
    def to_rexml_internal(parent, context)
      REXML::DocType.new([self.root_element_name, self.generate_content], parent)
    end
  end

  class ProcIns
    def to_rexml_internal(parent, context)
      r = REXML::Instruction.new(self.target, self.content)
      parent << r if parent
      r
    end
  end

  class Comment
    def to_rexml_internal(parent, context)
      REXML::Comment.new(self.content, parent)
    end
  end

  class BogusETag
    def to_rexml_internal(parent, context)
      nil
    end
  end

  # :startdoc:
end