Method: RubySpeech::NLSML::Document#initialize

Defined in:
lib/ruby_speech/nlsml/document.rb

#initialize(xml) ⇒ Document

Returns a new instance of Document.



6
7
8
9
10
11
12
13
# File 'lib/ruby_speech/nlsml/document.rb', line 6

def initialize(xml)
  result = xml.respond_to?(:root) ? xml.root : xml
  unless result.namespace
    result.default_namespace = NLSML_NAMESPACE
    result = Nokogiri::XML.parse(xml.to_xml, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS).root
  end
  super result
end