XmlMarkup gives 2 root elements

Hi there,

I try to check out what's the best way to create a small XML File (need
it for a bank transfer)

Anyway: I try the following under the ruby console:

require 'builder'
x = Builder::XmlMarkup.new
x.instruct!
test = x.Hello("World!", "type" => "global")

What I receive in test is the following:

<inspect/>
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<Hello type=\"global\">World!</Hello>"

So how can I get rid of the <inspect/> element. I think this file is A
BIT against the W3C XML standard.

Thanks for any advices,

Holm

···

--
Posted via http://www.ruby-forum.com/.

Try it without irb. Standard IRB automatically calls "inspect" on the builder object after each line which adds the "inspect" element ;).

Regards,
Florian

···

On Jan 19, 2012, at 7:08 PM, Holm Dressler wrote:

Hi there,

I try to check out what's the best way to create a small XML File (need
it for a bank transfer)

Anyway: I try the following under the ruby console:

require 'builder'
x = Builder::XmlMarkup.new
x.instruct!
test = x.Hello("World!", "type" => "global")

What I receive in test is the following:

<inspect/>
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<Hello type=\"global\">World!</Hello>"

So how can I get rid of the <inspect/> element. I think this file is A
BIT against the W3C XML standard.

Thanks for any advices,

Holm

Florian Gilcher wrote in post #1041686:

···

On Jan 19, 2012, at 7:08 PM, Holm Dressler wrote:

test = x.Hello("World!", "type" => "global")
Thanks for any advices,

Holm

Try it without irb. Standard IRB automatically calls "inspect" on the
builder object after each line which adds the "inspect" element ;).

Regards,
Florian

Hi Florian,

f.ck. Thanks!!! Yesterday it took me about 2 hours to search in Google.

But now I know it forever.

Bye,

Holm

--
Posted via http://www.ruby-forum.com/\.