Sha256: ba0ad0e7b6cd1ad1642f9a6a970509b2376ff74c07ec61e3bc2bc38534531561
Contents?: true
Size: 491 Bytes
Versions: 3
Compression:
Stored size: 491 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[2]/@team").first p node.name == "tea" # print attribute name and value puts node.name + "=" + node.value puts node.name + "=" + node.to_s puts node.inspect # set the value of the attribute node.value = "Value" p node node = doc.root.find("/test/names/name[2]/@team").first.value = "Hi all" p node
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-xml-smart-0.1.12.1-i486-linux | examples/xpath_attrs.rb |
ruby-xml-smart-0.1.12-i486-linux | examples/xpath_attrs.rb |
ruby-xml-smart-0.1.11-i486-linux | examples/xpath_attrs.rb |