class XmlEvents
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Create a series of SAX-like XML events (e.g. start_tag, end_tag) from the markup code. XmlEvent objects are used in a way similar to XmlMarkup objects, except that a series of events are generated and passed to a handler rather than generating character-based markup.
Usage:
xe = Builder::XmlEvents.new(handler) xe.title("HI") # Sends start_tag/end_tag/text messages to the handler.
Indentation may also be selected by providing value for the indentation size and initial indentation level.
xe = Builder::XmlEvents.new(handler, indent_size, initial_indent_level)
XML Event Handler
The handler object must expect the following events.
start_tag(tag, attrs)-
Announces that a new tag has been found.
tagis the name of the tag andattrsis a hash of attributes for the tag. end_tag(tag)-
Announces that an end tag for
taghas been found. text(text)-
Announces that a string of characters (
text) has been found. A series of characters may be broken up into more than onetextcall, so the client cannot assume that a single callback contains all the text data.
Inherits from
Methods (defined here)
- # _end_tag
- # _start_tag
- # text!