123456789_123456789_123456789_123456789_123456789_

Class: RSS::XMLScanListener

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
self, ListenerMixin, XMLScan::Visitor, BaseListener
Inherits: RSS::BaseListener
Defined in: lib/rss/xmlscanner.rb

Constant Summary

ListenerMixin - Included

CONTENT_PATTERN, NAMESPLIT

Class Attribute Summary

Class Method Summary

BaseListener - Inherited

.available_tags

return the tag_names for setters associated with uri.

.class_name

retrieve class_name for the supplied uri and tag_name If it doesn’t exist, capitalize the tag_name.

.getter,
.install_class_name

record class_name for the supplied uri and tag_name.

.install_get_text_element,
.register_uri

register uri against this name.

.setter

return the setter for the uri, tag_name pair, or nil.

.uri_registered?

test if this uri is registered against this name.

.def_get_text_element,
.install_accessor_base

set the accessor for the uri, tag_name pair.

Utils - Extended

element_initialize_arguments?

This method is used inside of several different objects to determine if special behavior is needed in the constructor.

get_file_and_line_from_caller

Returns an array of two elements: the filename where the calling method is located, and the line number where it is defined.

h,
html_escape

Takes a string s with some HTML in it, and escapes ‘&’, ‘“’, ‘<’ and ‘>’, by replacing them with the appropriate entities.

new_with_value_if_need

If value is an instance of class klass, return it, else create a new instance of klass with value value.

to_class_name

Given a name in a name_with_underscores or a name-with-dashes format, returns the CamelCase version of name.

Instance Attribute Summary

Instance Method Summary

Instance Method Details

#entity(ref) (private)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 112

def entity(ref)
  ent = ENTITIES[ref]
  if ent
    ent
  else
    wellformed_error("undefined entity: #{ref}")
  end
end

#on_attr_charref(code) Also known as: #on_attr_charref_hex

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 96

def on_attr_charref(code)
  @current_attr << [code].pack('U')
end

#on_attr_charref_hex(code)

Alias for #on_attr_charref.

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 100

alias_method(:on_attr_charref_hex, :on_attr_charref)

#on_attr_entityref(ref)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 92

def on_attr_entityref(ref)
  @current_attr << entity(ref)
end

#on_attr_value(str)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 88

def on_attr_value(str)
  @current_attr << str
end

#on_attribute(name)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 84

def on_attribute(name)
  @attrs[name] = @current_attr = ''
end

#on_cdata(data)

Alias for ListenerMixin#text.

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 64

alias_method(:on_cdata, :text)

#on_chardata(data)

Alias for ListenerMixin#text.

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 63

alias_method(:on_chardata, :text)

#on_charref(code) Also known as: #on_charref_hex

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 74

def on_charref(code)
  text([code].pack('U'))
end

#on_charref_hex(code)

Alias for #on_charref.

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 78

alias_method(:on_charref_hex, :on_charref)

#on_entityref(ref)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 70

def on_entityref(ref)
  text(entity(ref))
end

#on_etag(name)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 66

def on_etag(name)
  tag_end(name)
end

#on_pi(name, content)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 62

alias_method(:on_pi, :instruction)

#on_stag(name)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 80

def on_stag(name)
  @attrs = {}
end

#on_stag_end(name)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 102

def on_stag_end(name)
  tag_start(name, @attrs)
end

#on_stag_end_empty(name)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 106

def on_stag_end_empty(name)
  tag_start(name, @attrs)
  tag_end(name)
end

#on_xmldecl_encoding(str)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 50

def on_xmldecl_encoding(str)
  @encoding = str
end

#on_xmldecl_end

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 58

def on_xmldecl_end
  xmldecl(@version, @encoding, @standalone == "yes")
end

#on_xmldecl_standalone(str)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 54

def on_xmldecl_standalone(str)
  @standalone = str
end

#on_xmldecl_version(str)

[ GitHub ]

  
# File 'lib/rss/xmlscanner.rb', line 46

def on_xmldecl_version(str)
  @version = str
end