delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:

<component timestamp= name=some_name.dll />
as you can probably tell, this doesnt look good. Could some kind soul let me know how to put the " char correctly into my output please?
Cheers
-
Karym6


Hi All,
I had a brilliant thought this morning, why not use ruby to generate some xml for me.
Was a great idea, but I have fallen flat on my face when it comes to adding " to my xml file.
I am trying to create this line: puts results_file.puts "<component timestamp="" name=""#{x}"" />"
But, my issue is that it is giving me:
<component timestamp= name=some_name.dll />
as you can probably tell, this doesnt look good. Could some kind soul let me know how to put the " char correctly into my output please?
Cheers
-
Karym6

TOP

and I figured it out by using \" to include them in the file making my code look like:
puts results_file.puts "<component timestamp=\"\" name=\"#{x}\" />
Originally Posted by karym6
Hi All,
I had a brilliant thought this morning, why not use ruby to generate some xml for me.
Was a great idea, but I have fallen flat on my face when it comes to adding " to my xml file.
I am trying to create this line: puts results_file.puts "<component timestamp="" name=""#{x}"" />"
But, my issue is that it is giving me:
<component timestamp= name=some_name.dll />
as you can probably tell, this doesnt look good. Could some kind soul let me know how to put the " char correctly into my output please?
Cheers
-
Karym6

TOP

Even more graceful - thanks
Originally Posted by Scorpions4ever
Alternatively, you could enclose your string in %Q{}
Code:
  1. #!/usr/bin/ruby
  2. x = "hello"
  3. f = File.open("file.txt", "w")
  4. f.puts %Q{<component timestamp="" name="#{x}" />}
  5. f.close()
Copy Code
Note that %q won't substitute #{x} and will leave it in literally, whereas %Q will interpolate the variable.




<component timestamp= name=some_name.dll />
as you can probably tell, this doesnt look good. Could some kind soul let me know how to put the " char correctly into my output please?
Cheers
-
Karym6

TOP

Back Forum