Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby27/share/ruby/rss
File: xmlscanner.rb
# frozen_string_literal: false
[0] Fix | Delete
require 'xmlscan/scanner'
[1] Fix | Delete
require 'stringio'
[2] Fix | Delete
[3] Fix | Delete
module RSS
[4] Fix | Delete
[5] Fix | Delete
class XMLScanParser < BaseParser
[6] Fix | Delete
[7] Fix | Delete
class << self
[8] Fix | Delete
def listener
[9] Fix | Delete
XMLScanListener
[10] Fix | Delete
end
[11] Fix | Delete
end
[12] Fix | Delete
[13] Fix | Delete
private
[14] Fix | Delete
def _parse
[15] Fix | Delete
begin
[16] Fix | Delete
if @rss.is_a?(String)
[17] Fix | Delete
input = StringIO.new(@rss)
[18] Fix | Delete
else
[19] Fix | Delete
input = @rss
[20] Fix | Delete
end
[21] Fix | Delete
scanner = XMLScan::XMLScanner.new(@listener)
[22] Fix | Delete
scanner.parse(input)
[23] Fix | Delete
rescue XMLScan::Error => e
[24] Fix | Delete
lineno = e.lineno || scanner.lineno || input.lineno
[25] Fix | Delete
raise NotWellFormedError.new(lineno){e.message}
[26] Fix | Delete
end
[27] Fix | Delete
end
[28] Fix | Delete
[29] Fix | Delete
end
[30] Fix | Delete
[31] Fix | Delete
class XMLScanListener < BaseListener
[32] Fix | Delete
[33] Fix | Delete
include XMLScan::Visitor
[34] Fix | Delete
include ListenerMixin
[35] Fix | Delete
[36] Fix | Delete
ENTITIES = {
[37] Fix | Delete
'lt' => '<',
[38] Fix | Delete
'gt' => '>',
[39] Fix | Delete
'amp' => '&',
[40] Fix | Delete
'quot' => '"',
[41] Fix | Delete
'apos' => '\''
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
def on_xmldecl_version(str)
[45] Fix | Delete
@version = str
[46] Fix | Delete
end
[47] Fix | Delete
[48] Fix | Delete
def on_xmldecl_encoding(str)
[49] Fix | Delete
@encoding = str
[50] Fix | Delete
end
[51] Fix | Delete
[52] Fix | Delete
def on_xmldecl_standalone(str)
[53] Fix | Delete
@standalone = str
[54] Fix | Delete
end
[55] Fix | Delete
[56] Fix | Delete
def on_xmldecl_end
[57] Fix | Delete
xmldecl(@version, @encoding, @standalone == "yes")
[58] Fix | Delete
end
[59] Fix | Delete
[60] Fix | Delete
alias_method(:on_pi, :instruction)
[61] Fix | Delete
alias_method(:on_chardata, :text)
[62] Fix | Delete
alias_method(:on_cdata, :text)
[63] Fix | Delete
[64] Fix | Delete
def on_etag(name)
[65] Fix | Delete
tag_end(name)
[66] Fix | Delete
end
[67] Fix | Delete
[68] Fix | Delete
def on_entityref(ref)
[69] Fix | Delete
text(entity(ref))
[70] Fix | Delete
end
[71] Fix | Delete
[72] Fix | Delete
def on_charref(code)
[73] Fix | Delete
text([code].pack('U'))
[74] Fix | Delete
end
[75] Fix | Delete
[76] Fix | Delete
alias_method(:on_charref_hex, :on_charref)
[77] Fix | Delete
[78] Fix | Delete
def on_stag(name)
[79] Fix | Delete
@attrs = {}
[80] Fix | Delete
end
[81] Fix | Delete
[82] Fix | Delete
def on_attribute(name)
[83] Fix | Delete
@attrs[name] = @current_attr = ''
[84] Fix | Delete
end
[85] Fix | Delete
[86] Fix | Delete
def on_attr_value(str)
[87] Fix | Delete
@current_attr << str
[88] Fix | Delete
end
[89] Fix | Delete
[90] Fix | Delete
def on_attr_entityref(ref)
[91] Fix | Delete
@current_attr << entity(ref)
[92] Fix | Delete
end
[93] Fix | Delete
[94] Fix | Delete
def on_attr_charref(code)
[95] Fix | Delete
@current_attr << [code].pack('U')
[96] Fix | Delete
end
[97] Fix | Delete
[98] Fix | Delete
alias_method(:on_attr_charref_hex, :on_attr_charref)
[99] Fix | Delete
[100] Fix | Delete
def on_stag_end(name)
[101] Fix | Delete
tag_start(name, @attrs)
[102] Fix | Delete
end
[103] Fix | Delete
[104] Fix | Delete
def on_stag_end_empty(name)
[105] Fix | Delete
tag_start(name, @attrs)
[106] Fix | Delete
tag_end(name)
[107] Fix | Delete
end
[108] Fix | Delete
[109] Fix | Delete
private
[110] Fix | Delete
def entity(ref)
[111] Fix | Delete
ent = ENTITIES[ref]
[112] Fix | Delete
if ent
[113] Fix | Delete
ent
[114] Fix | Delete
else
[115] Fix | Delete
wellformed_error("undefined entity: #{ref}")
[116] Fix | Delete
end
[117] Fix | Delete
end
[118] Fix | Delete
end
[119] Fix | Delete
[120] Fix | Delete
end
[121] Fix | Delete
[122] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function