Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The only thing I can think is that ParseStream is undefined. A quick search through the Expat, Parser, and Twig modules reveals no other instance of "ParseStream." What could be going on? I have used PPM to "verify --force update" all relevant modules, but to no avail. Here is a snippet of my code:sub parse { my $self = shift; my $arg = shift; croak "Parse already in progress (Expat)" if $self->{Used}; $self->{Used} = 1; my $parser = $self->{Parser}; my $ioref; my $result = 0; if (defined $arg) { if (ref($arg) and UNIVERSAL::isa($arg, 'IO::Handler')) { $ioref = $arg; } else { eval { no strict 'refs'; $ioref = *{$arg}{IO}; }; } } if (defined($ioref)) { my $delim = $self->{Stream_Delimiter}; my $prev_rs; $prev_rs = ref($ioref)->input_record_separator("\n$delim\n") if defined($delim); $result = ParseStream($parser, $ioref, $delim); ### Line 439 ref($ioref)->input_record_separator($prev_rs) if defined($delim); } else { $result = ParseString($parser, $arg); } $result or croak $self->{ErrorMessage}; }
Thank you wise ones. Your wisdom is like ambrosia.#!C:/Perl use XML::Parser; use XML::Parser::Expat; use XML::Twig; my $t = XML::Twig->new( twig_roots => { '/invoice/header/accountnumber' => \&print_elt_text } ); $t->parsefile('MyHugeXML.xml'); sub print_elt_text { my( $t, $elt ) = @_; print $elt->text; $t->purge; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML-Twig
by bart (Canon) on Aug 27, 2002 at 00:49 UTC | |
|
Re: XML-Twig
by PodMaster (Abbot) on Aug 27, 2002 at 07:49 UTC |