Type:
Class

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

Nat Price gave me some good ideas for the API.

new

new(stream) Class Public methods

2015-05-07 06:55:52
unshift

unshift(token) Instance Public methods

2015-05-07 07:25:42
pull

pull() Instance Public methods

2015-05-07 07:20:25
peek

peek(depth=0) Instance Public methods

2015-05-07 07:14:56
each

each() Instance Public methods

2015-05-07 07:07:43
add_listener

add_listener( listener ) Instance Public methods

2015-05-07 07:01:52