#!/usr/local/bin/perl

use strict ;
use warnings;

use Sleepycat::DbXml 'simple' ;

#
# Example 12
#
# Demonstrate the definition of an index, and the iteration over
# set set of indexes specified.
#

eval
{
	my $container = new XmlContainer(undef,"test.dbxml");;
	$container->open(Db::DB_CREATE);
	$container->addIndex("", "title",
	         "node-element-equality-string, edge-element-equality-string");
	my $ix = $container->getIndexSpecification();
	my ($uri, $name, $index) ;
	while ($ix->next($uri,$name,$index))
	{
		print "$uri:$name $index\n";
	}
	$container->close();
	$container->remove();
};


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