2 |
## $Id$ |
## $Id$ |
3 |
## ------------------------------------------------------------------------ |
## ------------------------------------------------------------------------ |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.3 2003/05/13 08:08:17 joko |
6 |
|
## comments, todos |
7 |
|
## |
8 |
|
## Revision 1.2 2003/02/21 07:58:48 joko |
9 |
|
## enhanced error detection |
10 |
|
## |
11 |
## Revision 1.1 2003/02/20 20:20:54 joko |
## Revision 1.1 2003/02/20 20:20:54 joko |
12 |
## + initial commit |
## + initial commit |
13 |
## |
## |
31 |
use XML::Parser; |
use XML::Parser; |
32 |
use XML::Parser::EasyTree; |
use XML::Parser::EasyTree; |
33 |
use XML::XPath; |
use XML::XPath; |
34 |
|
# TODO: use XML::Writer and/or XML::ValidWriter |
35 |
|
|
36 |
sub sendQuery { |
sub sendQuery { |
37 |
my $self = shift; |
my $self = shift; |
38 |
my $xpq = shift; |
my $xpq = shift; |
39 |
my $options = shift; |
my $options = shift; |
40 |
|
|
41 |
$self->log( "xpq='$xpq'", 'info' ); |
$self->log( "xpq='$xpq'", 'debug' ); |
42 |
|
|
43 |
# trace |
# trace |
44 |
#print Dumper($self); |
#print Dumper($self); |
46 |
|
|
47 |
my $file = $self->{filename}; |
my $file = $self->{filename}; |
48 |
|
|
49 |
|
if (!$file) { |
50 |
|
$self->log("No filename given.", 'error'); |
51 |
|
return; |
52 |
|
} |
53 |
|
|
54 |
if (! -e $file) { |
if (! -e $file) { |
55 |
$self->log("File not found: '$file'.", 'error'); |
$self->log("File not found: '$file'.", 'error'); |
56 |
return; |
return; |
100 |
my $self = shift; |
my $self = shift; |
101 |
|
|
102 |
$XML::Parser::EasyTree::Noempty = 1; |
$XML::Parser::EasyTree::Noempty = 1; |
103 |
|
# what about ... |
104 |
|
#$XML::Parser::EasyTree::Latin = 1; |
105 |
|
# ... instead of an otherwise required |
106 |
|
# "expand" with proper utf8/latin-conversion |
107 |
|
# parameters set? |
108 |
|
|
109 |
# convert xml data to native perl data structure |
# convert xml data to native perl data structure |
110 |
#my $parser = XML::Parser->new( Style => 'EasyTree', Handlers => { Char => sub { my $char = shift; print "char: ", Dumper($char), "\n"; } } ); |
#my $parser = XML::Parser->new( Style => 'EasyTree', Handlers => { Char => sub { my $char = shift; print "char: ", Dumper($char), "\n"; } } ); |