in reply to Validate XML based on hash data structure

Untested, but should be pretty close to working:

XML::Twig->new( twig_handlers => { Fruit => sub { $_->cut unless( $col +or{$_->att( 'name')}); } } ) ->parsefile( "fruits.xml");

If memory is a problem, flush the twig at the end of the handler and after the parse.

Replies are listed 'Best First'.
Re^2: Validate XML based on hash data structure
by ramya2005 (Scribe) on Aug 17, 2005 at 23:05 UTC
    Thank you! It works