Created
January 31, 2012 22:39
-
-
Save Alfaj0r/1713518 to your computer and use it in GitHub Desktop.
Powerscribe templates XML parsing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rexml/document' | |
include REXML | |
#open the XML file exported from Powerscribe | |
file = File.new("Voice.xml") | |
doc = Document.new(file) | |
root = doc.root | |
#for each element of listed in the XML file we want to: | |
# display the "shortText" (which is the title of the Template) | |
# display the "longText" (which is the actual text of the Template) | |
#this works for spitting out element 3 for example: | |
puts "Template: " + root.elements[3].elements["shortText"].get_text.to_s | |
puts "Template text:" + root.elements[3].elements["longText"].get_text.to_s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment