Class: AXML::XMLParser::LazyPeaks

Inherits:
AXML::XMLParser
  • Object
show all
Defined in:
lib/ms/parser/mzxml/axml.rb

Overview

This parser stores information about where the peaks information is in the file The content of the peaks node is an array where the first member is the start index and the last member is the number of bytes. All other members should be ignored.

Instance Method Summary collapse

Instance Method Details

#character(data) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/ms/parser/mzxml/axml.rb', line 55

def character(data)
  if @cur.text.is_a? Array
    @cur.text << byteIndex
  else
    @cur.text << data
  end
end

#endElement(name) ⇒ Object



63
64
65
66
67
68
# File 'lib/ms/parser/mzxml/axml.rb', line 63

def endElement(name)
  if @cur.text.is_a? Array
    @cur.text << (byteIndex - @cur.text.first)
  end
  @cur = @cur.parent
end

#startElement(name, attributes) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ms/parser/mzxml/axml.rb', line 43

def startElement(name, attributes)
  text =
    if name == 'peaks' ; []
    else ; ''
    end
  new_el = ::AXML::El.new(@cur, name, attributes, text, [])
  # add the new node to the previous parent node
  @cur.add_node(new_el)
  # notice the change in @cur node
  @cur = new_el
end