Class REXML::PullParser
In: rexml/pullparser.rb
Parent: Object

Using the Pull Parser

This API is experimental, and subject to change.

 parser = PullParser.new( "<a>text<b att='val'/>txet</a>" )
 while parser.has_next?
   res = parser.next
   puts res[1]['att'] if res.start_tag? and res[0] == 'b'
 end

See the PullEvent class for information on the content of the results. The data is identical to the arguments passed for the various events to the StreamListener API.

Notice that:

 parser = PullParser.new( "<a>BAD DOCUMENT" )
 while parser.has_next?
   res = parser.next
   raise res[1] if res.error?
 end
Methods
empty?    has_next?    new    next   
Public Class methods
new(stream)
Public Instance methods
empty?()

Returns true if there are no more events

has_next?()

Returns true if there are more events. Synonymous with !empty?

next()

Returns the next event. This is a PullEvent object.