Sha256: 020a8acfe9146e55ec6aa3a4a6a84b57f152b48a68846bdb931f64a2037375d3
Contents?: true
Size: 362 Bytes
Versions: 3
Compression:
Stored size: 362 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/name[@team='2']").first # add siblings node.add_before("test_node",{"attr" => "12"}, "Muahaha") node.add_after("test_node", "Muahaha", {"attr" => "13"}) # print doc 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_elements.rb |
ruby-xml-smart-0.1.12-i486-linux | examples/add_elements.rb |
ruby-xml-smart-0.1.11-i486-linux | examples/add_elements.rb |