Class: SAXMachine::SAXOxHandler
- Inherits:
-
Ox::Sax
- Object
- Ox::Sax
- SAXMachine::SAXOxHandler
show all
- Includes:
- SAXAbstractHandler
- Defined in:
- lib/sax-machine/handlers/sax_ox_handler.rb
Constant Summary
SAXMachine::SAXAbstractHandler::NO_BUFFER
Instance Method Summary
collapse
#_characters, #_end_element, #_error, #_initialize, #_start_element, #_warning
Constructor Details
Returns a new instance of SAXOxHandler.
8
9
10
11
|
# File 'lib/sax-machine/handlers/sax_ox_handler.rb', line 8
def initialize(*args)
_initialize(*args)
_reset_element
end
|
Instance Method Details
#attr(name, str) ⇒ Object
24
25
26
|
# File 'lib/sax-machine/handlers/sax_ox_handler.rb', line 24
def attr(name, str)
@attrs[name] = str
end
|
#attrs_done ⇒ Object
28
29
30
31
|
# File 'lib/sax-machine/handlers/sax_ox_handler.rb', line 28
def attrs_done
_start_element(@element, @attrs)
_reset_element
end
|
#error(message, line, column) ⇒ Object
43
44
45
|
# File 'lib/sax-machine/handlers/sax_ox_handler.rb', line 43
def error(message, line, column)
_error("#{message} on line #{line} column #{column}")
end
|
#sax_parse(xml_input) ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/sax-machine/handlers/sax_ox_handler.rb', line 13
def sax_parse(xml_input)
xml_input = StringIO.new(xml_input) if xml_input.is_a?(String)
Ox.sax_parse(self, xml_input,
symbolize: false,
convert_special: true,
skip: :skip_return,
)
end
|
#start_element(name) ⇒ Object
33
34
35
|
# File 'lib/sax-machine/handlers/sax_ox_handler.rb', line 33
def start_element(name)
@element = name
end
|
#text(value) ⇒ Object
Also known as:
cdata
37
38
39
|
# File 'lib/sax-machine/handlers/sax_ox_handler.rb', line 37
def text(value)
_characters(value) if value && !value.empty?
end
|