Module: RubySpeech

Defined in:
lib/ruby_speech.rb,
lib/ruby_speech/ssml.rb,
lib/ruby_speech/grxml.rb,
lib/ruby_speech/nlsml.rb,
lib/ruby_speech/ssml/p.rb,
lib/ruby_speech/ssml/s.rb,
lib/ruby_speech/version.rb,
lib/ruby_speech/ssml/sub.rb,
lib/ruby_speech/grxml/tag.rb,
lib/ruby_speech/ssml/desc.rb,
lib/ruby_speech/ssml/mark.rb,
lib/ruby_speech/grxml/item.rb,
lib/ruby_speech/grxml/rule.rb,
lib/ruby_speech/ssml/audio.rb,
lib/ruby_speech/ssml/break.rb,
lib/ruby_speech/ssml/speak.rb,
lib/ruby_speech/ssml/voice.rb,
lib/ruby_speech/grxml/match.rb,
lib/ruby_speech/grxml/token.rb,
lib/ruby_speech/ssml/say_as.rb,
lib/ruby_speech/grxml/one_of.rb,
lib/ruby_speech/ssml/element.rb,
lib/ruby_speech/ssml/phoneme.rb,
lib/ruby_speech/ssml/prosody.rb,
lib/ruby_speech/xml/language.rb,
lib/ruby_speech/grxml/element.rb,
lib/ruby_speech/grxml/grammar.rb,
lib/ruby_speech/grxml/matcher.rb,
lib/ruby_speech/grxml/ruleref.rb,
lib/ruby_speech/nlsml/builder.rb,
lib/ruby_speech/ssml/emphasis.rb,
lib/ruby_speech/grxml/no_match.rb,
lib/ruby_speech/nlsml/document.rb,
lib/ruby_speech/generic_element.rb,
lib/ruby_speech/grxml/max_match.rb,
lib/ruby_speech/grxml/potential_match.rb,
ext/ruby_speech/ruby_speech.c

Defined Under Namespace

Modules: GRXML, GenericElement, NLSML, SSML, XML

Constant Summary collapse

VERSION =
"3.0.1"

Class Method Summary collapse

Class Method Details

.parse(string) ⇒ Object



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

def self.parse(string)
  document = Nokogiri::XML.parse string, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS
  namespace = document.root.namespace
  case namespace && namespace.href
  when SSML::SSML_NAMESPACE
    SSML::Element.import string
  when GRXML::GRXML_NAMESPACE
    GRXML::Element.import string
  when NLSML::NLSML_NAMESPACE, nil
    NLSML::Document.new document
  end
end