#!/bin/perl -w

#########################################################################
#                                                                       #
#  This example prints a table using various pretty print options       #
#                                                                       #
#########################################################################
use strict;
use XML::Twig;

my $string=
'<table><record><field1>value1</field1><field2>value2</field2></record><record><field1>value1(2)</field1><field2>value2(2)</field2></record><record><field1>value1(3)</field1><field2>value2(3)</field2></record></table>';

my $t= new XML::Twig;
$t->parse( $string);

print "normal:\n";
$t->set_pretty_print( 'none');       # this is the default
$t->print;
print "\n\n";

print "record:\n";              
$t->set_pretty_print( 'record');     # one field per line
$t->print;
print "\n\n";

print "record_c:\n";               
$t->set_pretty_print( 'record_c');   # one record per line
$t->print;
print "\n\n";

print "record:\n";                   
$t->print( PrettyPrint => 'record'); # alterate way to set the style
print "\n\n";
