Module: OXML

Defined in:
lib/oxml.rb,
lib/oxml/utils.rb,
lib/oxml/parser.rb,
lib/oxml/builder.rb,
lib/oxml/version.rb

Defined Under Namespace

Modules: Utils Classes: Builder, Parser

Constant Summary collapse

VERSION =
'0.5.1'

Class Method Summary collapse

Class Method Details

.build(hash) ⇒ Object



20
21
22
# File 'lib/oxml.rb', line 20

def build(hash)
  Builder.new(hash).to_s
end

.parse(xml, options = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/oxml.rb', line 13

def parse(xml, options = {})
  handler = Parser.new(options)
  Ox.default_options = { encoding: 'UTF-8', skip: :skip_return}
  Ox.sax_parse(handler, xml)
  handler.to_h
end