File: modify.rb

package info (click to toggle)
libdb-ruby 0.6.5-6
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,612 kB
  • ctags: 3,979
  • sloc: ansic: 13,984; cpp: 8,739; ruby: 7,864; sh: 47; makefile: 8
file content (23 lines) | stat: -rwxr-xr-x 482 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/local/bin/ruby
$LOAD_PATH.unshift("..", "../../src")
require 'bdbxml'

include BDB::XML

File.unlink("exa.dbxml") rescue nil

man = Manager.new
doc = man.create_document
at_exit {
   doc.close
   man.close
}
doc.name = "test1"
doc.content = '<?xml version="1.0" encoding="utf-8" standalone="no"?><root/>'
puts "#{doc.name} = #{doc}"
que = man.prepare("/root")
mod = Modify.new(man)
mod.append(que, Modify::Element, "new", "foo")
mod.execute(doc)
puts "#{doc.name} = #{doc}"