Reputation: 13
I wrote a program to convert a xml file. I started it with the following command
ruby Skribt.rb example
Here is a part of the code:
sessionid = ARGV[0].dup
inputfile = "upload/" + sessionid + "_source.xml" # Hochgeladene XML Datei
outputfile = "output/" + sessionid + ".xml"
stringKomplett = File.read(inputfile,encoding: "UTF-8").gsub(/<group.*?type=\"public\".*?\/>/, "")
I get the following error and do not know how to solve this.
Skript.rb:16: syntax error, unexpected ':', expecting ')'
... File.read(inputfile,encoding: "UTF-8").gsub(/<group.*?type=...
^
Skript.rb:16: syntax error, unexpected ')', expecting $end
...d(inputfile,encoding: "UTF-8").gsub(/<group.*?type=\"public\...
^
I hope you can help me with this problem. Thank you in advance for you help.
Greetings
Upvotes: 1
Views: 1072
Reputation: 16506
It seems you are using older Ruby version. Try this instead:
File.read(inputfile, :encoding => "UTF-8").gsub(/<group.*?type=\"public\".*?\/>/, "")
Upvotes: 2