Class: OpenSRS::XmlProcessor::Libxml

Inherits:
OpenSRS::XmlProcessor show all
Includes:
LibXML::XML
Defined in:
lib/opensrs/xml_processor/libxml.rb

Class Method Summary collapse

Methods inherited from OpenSRS::XmlProcessor

parse

Class Method Details

.build(data) ⇒ Object

First, builds REXML elements for the inputted data. Then, it will go ahead and build the entire XML document to send to OpenSRS.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/opensrs/xml_processor/libxml.rb', line 9

def self.build(data)
  xml = Document.new
  xml.root = envelope = Node.new("OPS_envelope")

  envelope << header = Node.new("header")
  envelope << body = Node.new("body")
  header   << Node.new("version", "0.9")
  body     << data_block = Node.new("data_block")

  data_block << encode_data(data, data_block)

  return xml.to_s
end