--- nfo/perl/libs/Data/Storage/Handler/XML.pm 2003/02/21 07:58:48 1.2 +++ nfo/perl/libs/Data/Storage/Handler/XML.pm 2003/12/05 04:52:40 1.5 @@ -1,7 +1,16 @@ ## ------------------------------------------------------------------------ -## $Id: XML.pm,v 1.2 2003/02/21 07:58:48 joko Exp $ +## $Id: XML.pm,v 1.5 2003/12/05 04:52:40 joko Exp $ ## ------------------------------------------------------------------------ ## $Log: XML.pm,v $ +## Revision 1.5 2003/12/05 04:52:40 joko +## + minor update: changed some loglevel to debug +## +## Revision 1.4 2003/06/06 03:58:13 joko +## minor updates to logging +## +## Revision 1.3 2003/05/13 08:08:17 joko +## comments, todos +## ## Revision 1.2 2003/02/21 07:58:48 joko ## enhanced error detection ## @@ -22,13 +31,18 @@ ); +# TODO: Load them on demand! use Data::Dumper; #use Data::Storage::Handler::File::Basic qw( s2f a2f f2s ); use XML::Simple; use XML::Parser; use XML::Parser::EasyTree; use XML::XPath; +# TODO: use XML::Writer and/or XML::ValidWriter + +# get logger instance +my $logger = Log::Dispatch::Config->instance; sub sendQuery { my $self = shift; @@ -44,18 +58,20 @@ my $file = $self->{filename}; if (!$file) { - $self->log("No filename given.", 'error'); + $logger->error("No filename given."); return; } if (! -e $file) { - $self->log("File not found: '$file'.", 'error'); + $logger->error("File not found: '$file'."); return; } #print "file: $file", "\n"; #print "xpq: $xpq", "\n"; - + + $logger->debug( __PACKAGE__ . "->sendQuery - File: $file, xpq: $xpq"); + # filter nodes by xpath-query my $xp = XML::XPath->new( filename => $file ); my $nodeset = $xp->find($xpq); @@ -97,6 +113,11 @@ my $self = shift; $XML::Parser::EasyTree::Noempty = 1; + # what about ... + #$XML::Parser::EasyTree::Latin = 1; + # ... instead of an otherwise required + # "expand" with proper utf8/latin-conversion + # parameters set? # convert xml data to native perl data structure #my $parser = XML::Parser->new( Style => 'EasyTree', Handlers => { Char => sub { my $char = shift; print "char: ", Dumper($char), "\n"; } } );