Class: SAXMachine::SAXEventRecorder
- Inherits:
-
SAXHandler
- Object
- Nokogiri::XML::SAX::Document
- SAXHandler
- SAXMachine::SAXEventRecorder
show all
- Defined in:
- lib/sax-machine/sax_event_recorder.rb
Instance Method Summary
collapse
Methods inherited from SAXHandler
#cdata_block, #characaters_captured?, decode_xml, #parse_collection_instance_attributes, #parse_element_attributes, #parsing_collection?, #reset_current_collection, #reset_current_tag, #set_element_config_for_element_value
Constructor Details
Returns a new instance of SAXEventRecorder.
3
4
5
6
|
# File 'lib/sax-machine/sax_event_recorder.rb', line 3
def initialize(nsstack)
super(nil, nsstack)
@events = []
end
|
Instance Method Details
#characters(string) ⇒ Object
27
28
29
|
# File 'lib/sax-machine/sax_event_recorder.rb', line 27
def characters(string)
@events << [:chars, string]
end
|
#end_element(name) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/sax-machine/sax_event_recorder.rb', line 20
def end_element(name)
prefix, name = name.split(COLON, 2)
prefix, name = nil, prefix unless name
@events << [:end_element, @nsstack[prefix], name]
@nsstack = @nsstack.pop
end
|
#object ⇒ Object
8
9
10
11
|
# File 'lib/sax-machine/sax_event_recorder.rb', line 8
def object
@events[1..-2]
end
|
#sax_config ⇒ Object
31
32
33
|
# File 'lib/sax-machine/sax_event_recorder.rb', line 31
def sax_config
raise
end
|
#start_element(name, attrs = nil) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/sax-machine/sax_event_recorder.rb', line 13
def start_element(name, attrs = nil)
@nsstack = NSStack.new(@nsstack, attrs)
prefix, name = name.split(COLON, 2)
prefix, name = nil, prefix unless name
@events << [:start_element, @nsstack[prefix], name, attrs]
end
|