/ Published in: Ruby
split
Expand |
Embed | Plain Text
require "rexml/document" include REXML file=File.open('<filename>.xml') f=file.read() parts=f.split('<?xml') Dir.mkdir("docs") counter=0 parts.reverse!.pop parts.reverse! parts.each { |part| counter=counter+1 out=File.new("./docs/#{counter}.xml", 'w') out.puts("<?xml #{part}") #find filename }
You need to login to post a comment.
