Forum: Ruby libxml (XML::Node.content)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Kuba P. (Guest)
on 2007-07-23 19:07
Hello all, quick question regarding XML:Node.content method.

Why content is empty for following <code>?

    doc =
    doc.root ='root_node')
    root = doc.root
    root << elem1 ='elem1')

    elem1['attr1'] = 'Value 1'
    elem1.content  = 'Element 1''output.xml', true)

    doc = XML::Document.file('output.xml')
    doc.root.find('elem1').each { |e|
puts "#{e}\t text?:#{e.text?}\t content:#{e.content}"

Element 1       text?:false     content:
This topic is locked and can not be replied to.