Bugs item #21424, was opened at 2008-08-03 09:50
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21424&group_id=494
Category: General
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Nobody (None)
>Assigned to: Charlie Savage (cfis)
Summary: Stringing commands bypasses correct node creation
Initial Comment:
When I create something along the lines of:
foo << XML::Node.new('bar') << "bars contents"
The following is returned:
---------
<foo>
<bar/>bars contents
</foo>
---------
However, this:
foo << bar = XML::Node.new('bar')
bar << "bars contents"
returns this:
---------
<foo>
<bar>bars contents</bar>
</foo>
---------
These results have been sporadic at times, it seems. When I create
XML::Documents in the console, sometimes it works fine, sometimes it doesn't.
I have been unable to pinpoint a specific cause, but I am, however, having to
rewrite a good bit of my code because invalid XML is being produced due to this
bug.
----------------------------------------------------------------------
>Comment By: Charlie Savage (cfis)
Date: 2008-08-20 02:26
Message:
Hi Eric,
The problem is that << returns self, and not the appended child. I've changed
this in trunk, so the next version of libxml should work the way you request.
----------------------------------------------------------------------
Comment By: Eric Musgrove (tenpaiyomi)
Date: 2008-08-03 10:01
Message:
This also applies to the node creation as well, as can be seen here:
>> a = XML::Document.new()
=> <?xml version="1.0"?>
>> a.root = XML::Node.new('foo')
=> <foo/>
>> root = a.root
=> <foo/>
>> root << XML::Node.new('bar') << XML::Node.new('baz')
=> <foo>
<bar/>
<baz/>
</foo>
>> a = XML::Document.new()
=> <?xml version="1.0"?>
>> a.root = XML::Node.new('foo')
=> <foo/>
>> root = a.root
=> <foo/>
>> root << bar = XML::Node.new('bar')
=> <foo>
<bar/>
</foo>
>> bar << XML::Node.new('baz')
=> <bar>
<baz/>
</bar>
>> a
=> <?xml version="1.0"?>
<foo>
<bar>
<baz/>
</bar>
</foo>
>>
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21424&group_id=494
_______________________________________________
libxml-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/libxml-devel