Class

REXML::Parsers::PullParser

Inheritance
< Object
Included Modules
XMLTokens

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.

Methods

Class

Visibility Signature
public new (stream)

Instance

Visibility Signature
public add_listener ( listener )
public each () {|self.pull| ...}
public peek (depth=0)
public pull ()
public unshift (token)

Class Method Detail

new(stream)

Instance Method Detail

add_listener( listener )

each() {|self.pull| ...}

peek(depth=0)

pull()

unshift(token)