Class: OpenSRS::XmlProcessor::Nokogiri

Inherits:
OpenSRS::XmlProcessor show all
Defined in:
lib/opensrs/xml_processor/nokogiri.rb

Class Method Summary collapse

Methods inherited from OpenSRS::XmlProcessor

parse

Class Method Details

.build(data) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/opensrs/xml_processor/nokogiri.rb', line 11

def self.build(data)
  builder = ::Nokogiri::XML::Builder.new

  envelope   = ::Nokogiri::XML::Node.new("OPS_envelope", builder.doc)
  header     = ::Nokogiri::XML::Node.new("header", builder.doc)
  version    = ::Nokogiri::XML::Node.new("version", builder.doc)
  body       = ::Nokogiri::XML::Node.new("body", builder.doc)
  data_block = ::Nokogiri::XML::Node.new("data_block", builder.doc)
  other_data = encode_data(data, builder.doc)
  builder.doc << envelope << header << version << '0.9'
  envelope << body << data_block << other_data
  return builder.to_xml
end