Class: Veracode::XML::SAXParser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callback = nil) ⇒ SAXParser

Returns a new instance of SAXParser.



72
73
74
# File 'lib/veracode/parser/parser.rb', line 72

def initialize(callback=nil)

end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object



69
70
# File 'lib/veracode/parser/parser.rb', line 69

def method_missing(sym, *args)
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



46
47
48
# File 'lib/veracode/parser/parser.rb', line 46

def options
  @options
end

Instance Method Details

#stackObject



47
48
49
# File 'lib/veracode/parser/parser.rb', line 47

def stack
  @stack ||= []
end

#tag_end(name) ⇒ Object



55
56
57
58
59
60
# File 'lib/veracode/parser/parser.rb', line 55

def tag_end(name)
  if stack.size > 1
    last = stack.pop
    stack.last.add_node last
  end
end

#tag_start(name, attrs) ⇒ Object



51
52
53
# File 'lib/veracode/parser/parser.rb', line 51

def tag_start(name, attrs)
  stack.push Nori::XMLUtilityNode.new(options, name, Hash[*attrs.flatten]) 
end

#text(string) ⇒ Object Also known as: cdata



62
63
64
# File 'lib/veracode/parser/parser.rb', line 62

def text(string)
  stack.last.add_node(string) unless string.strip.length == 0 || stack.empty?
end