Class: XSD::Mapping::Mapper
Constant Summary collapse
- MAPPING_OPT =
{:default_encodingstyle => SOAP::LiteralNamespace}
Instance Method Summary collapse
-
#initialize(registry) ⇒ Mapper
constructor
A new instance of Mapper.
- #obj2xml(obj, elename = nil, io = nil) ⇒ Object
- #xml2obj(stream, klass = nil) ⇒ Object
Constructor Details
#initialize(registry) ⇒ Mapper
Returns a new instance of Mapper.
33 34 35 |
# File 'lib/xsd/mapping.rb', line 33 def initialize(registry) @registry = registry end |
Instance Method Details
#obj2xml(obj, elename = nil, io = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/xsd/mapping.rb', line 37 def obj2xml(obj, elename = nil, io = nil) if !elename.nil? and !elename.is_a?(XSD::QName) elename = XSD::QName.new(nil, elename) end soap = SOAP::Mapping.obj2soap(obj, @registry, elename) if soap.elename.nil? or soap.elename == XSD::QName::EMPTY soap.elename = XSD::QName.new(nil, SOAP::Mapping.name2elename(obj.class.to_s)) end generator = SOAP::SOAPGenerator.new(MAPPING_OPT) generator.generate(soap, io) end |