#!/usr/local/bin/perl

use strict;
use warnings;

use Sleepycat::DbXml 'simple' ;

#
# Example 1
#
# Create an XML Container, add a document, get the document,
# display the content of the document.
#

eval
{
	my $container = new XmlContainer("test.dbxml");
	$container->open(Db::DB_CREATE);
	my $document = new XmlDocument ;

	$document->setContent(<<EOM);
	    <book>
	        <title>
		    Knowledge Discovery in Databases.
		</title>
	    </book>
EOM
	my $id= $container->putDocument($document);
	$document= $container->getDocument($id);
	print "$id  = " .  $document->getContentAsString() . "\n";
	$container->close();
	$container->remove();
};


if (my $e = catch std::exception)
{
	warn $e->what(), "\n";
}
elsif ($@)
{
	warn $@;
}
