Module: Saml::XMLHelpers
- Extended by:
- ActiveSupport::Concern
- Included in:
- Assertion, ComplexTypes::RequestAbstractType, Elements::EntitiesDescriptor, Elements::EntityDescriptor
- Defined in:
- lib/saml/xml_helpers.rb
Instance Method Summary collapse
Instance Method Details
#to_soap ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/saml/xml_helpers.rb', line 18 def to_soap builder = Nokogiri::XML::Builder.new body = self.to_xml(builder) builder = Nokogiri::XML::Builder.new(:encoding => "UTF-8") builder.Envelope(:'xmlns:soapenv' => "http://schemas.xmlsoap.org/soap/envelope/", :'xmlns:xsd' => "http://www.w3.org/2001/XMLSchema", :'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance") do |xml| builder.parent.namespace = builder.parent.namespace_definitions.find { |n| n.prefix == 'soapenv' } builder.Body do builder.parent.add_child body.doc.root end end builder.to_xml end |
#to_xml(builder = nil, default_namespace = nil, instruct = true) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/saml/xml_helpers.rb', line 5 def to_xml(builder = nil, default_namespace = nil, instruct = true) write_xml = builder.nil? ? true : false builder ||= Nokogiri::XML::Builder.new builder.doc.encoding = "UTF-8" result = super(builder, default_namespace) if write_xml instruct ? result.to_xml : result.doc.root else result end end |