Module: SAXMachine
- Defined in:
- lib/sax-machine.rb,
lib/sax-machine/ns_stack.rb,
lib/sax-machine/sax_config.rb,
lib/sax-machine/sax_handler.rb,
lib/sax-machine/sax_document.rb,
lib/sax-machine/sax_element_config.rb,
lib/sax-machine/sax_event_recorder.rb,
lib/sax-machine/sax_collection_config.rb
Defined Under Namespace
Modules: ClassMethods
Classes: NSStack, SAXConfig, SAXEventRecorder, SAXHandler
Constant Summary
collapse
- VERSION =
"0.0.21"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
5
6
7
|
# File 'lib/sax-machine/sax_document.rb', line 5
def self.included(base)
base.extend ClassMethods
end
|
Instance Method Details
#parse(xml_text) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/sax-machine/sax_document.rb', line 9
def parse(xml_text)
unless @parser
sax_handler = SAXHandler.new(self)
@parser = Nokogiri::XML::SAX::PushParser.new(sax_handler)
@parser.options |= Nokogiri::XML::ParseOptions::RECOVER if @parser.respond_to?(:options)
end
@parser << xml_text
self
end
|
#parse_finish ⇒ Object
19
20
21
22
23
24
|
# File 'lib/sax-machine/sax_document.rb', line 19
def parse_finish
if @parser
@parser.finish
end
self
end
|