Skip to content

Instantly share code, notes, and snippets.

@sandrods
Last active August 29, 2015 14:04
Show Gist options
  • Save sandrods/960841cd341866a991e1 to your computer and use it in GitHub Desktop.
Save sandrods/960841cd341866a991e1 to your computer and use it in GitHub Desktop.
script to visualize the xml content of a .odt file
#!/usr/bin/env ruby
require 'launchy'
require "nokogiri"
require "zip"
xml = ""
Zip::File.open(ARGV[0]) do |zip|
content = zip.get_entry('content.xml').get_input_stream.read
xml = Nokogiri::XML(content).to_xml
end
dir = Dir.mktmpdir
filename = "#{dir}/result.xml"
File.open(filename, 'w') { |f| f.write xml }
Launchy.open filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment