writing xml

Pabloz wrote:

I am having a problem with writing xml file. I am using REXML.
Everything goes fine on IRB,

Stop using IRB and start using unit tests. You should write a little bit of a test case and 'p' a result, then run 'rake recent' and read your console. If the result is correct, write an assertion that locks it in and repeat. Small experiments with test cases will replace small experiments with IRB, and will preserve a history of correct results. This is how RoR itself was created, and it's a major reason RoR is so powerful.

i can add new elements to my existing file,
add atributes or text. When i print my xml in IRB it looks ok. Then i
try xml.write(STDOUT, 0), and i get no errors but the xml does not
change. My persmissions look ok. I am working on windows XP. Any clue?

STDOUT is your console's handle as a file stream. It's not a real file. Try this:

File.open('foo.xml', 'w') {|f| xml.write(f, 0) }

Hi --

You may like to watch the latest Peepcode screencast on test-first development called, well, Test-First Development:


Andy Stewart