Class: XML::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/index.rb

Overview

Add custom parsing methods to XML::Reader

Instance Method Summary collapse

Instance Method Details

#next_entityObject

Get the next entity node



297
298
299
300
301
302
303
# File 'lib/index.rb', line 297

def next_entity
  # read until an entity node
  while (self.node_type != XML::Reader::TYPE_ENTITY and
    self.node_type != XML::Reader::TYPE_ENTITY_REFERENCE and
    self.read); end
  self.value
end

#next_textObject

Get the next text node



291
292
293
294
295
# File 'lib/index.rb', line 291

def next_text
  # read until a text node
  while (self.node_type != XML::Reader::TYPE_TEXT and self.read); end
  self.value
end