Sha256: 550c3c9691b6ba19d6494e200047dd1b2f99492ed441cc58172a6fe34819d98b

Contents?: true

Size: 413 Bytes

Versions: 3

Compression:

Stored size: 413 Bytes

Contents

#!/usr/bin/ruby
require "#{File.dirname($0)}/../smart"

# No closure, so changes are temporary
doc = XML::Smart.open(File.dirname($0) + "/EXAMPLE.xml")
node = doc.root.find("/test/names").first

# append children
node.add("test_node", {"attr" => 12}, "Muahaha")
node.add("test_node", "Muahaha", {"attr" => 13})
node.add("test_node", {"attr" => 14})
node.add("test_node", "Muahaha")
node.add("test_node")
puts doc

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-xml-smart-0.1.12.1-i486-linux examples/add_children.rb
ruby-xml-smart-0.1.12-i486-linux examples/add_children.rb
ruby-xml-smart-0.1.11-i486-linux examples/add_children.rb