XML-SAX-Writer - sax parser not working in mason. works from shell.

Posted on Fri Apr 13 15:19:11 2007 by flobadob
sax parser not working in mason. works from shell.
Hello, my website is xml driven and I have a sax parser which goes through the xml, and outputs a clientname,username and password whereever it encounters one. The parser returns many such occurances when run from the shell, but only one row when run from within mason. Stumped. Could there be an error raised when run within mason which I can't see? How do I get access to such an error? Here is the mason code and sax parser if that helps...
<%init> # extract the client/username/password list... my $list; my $wr = XML::SAX::Writer->new(Output => \$list); my $ex = AMI::SAXFilter::ClientUserPwdList->new(Handler => $wr); my $pz = XML::SAX::ParserFactory->parser(Handler => $ex); $pz->parse_uri($xmlfile); print $list; </%init>
...and the SAX parser itself...
package AMI::SAXFilter::ClientUserPwdList; use strict; #use base qw(XML::SAX::Base); use XML::SAX::Base; use vars qw/@ISA/; @ISA = qw/XML::SAX::Base/; my $lastclient; sub start_element { my ($self, $element) = @_; if( $element->{Name} eq "client" ) { my %attrs = %{$element->{Attributes}}; my $nameref = $attrs{'{}name'}; $lastclient = $nameref->{Value}; } elsif( $element->{Name} eq "auth" ) { my %attrs = %{$element->{Attributes}}; my $usernameref = $attrs{'{}username'}; my $passwordref = $attrs{'{}passwor +d'}; my $username = $usernameref->{Value}; my $password = $passwordref->{Value}; my $row = $lastclient . $username . $password; $self->SUPER::characters({Data => $row}); } } sub end_element { } sub characters { } sub start_cdata { } sub end_cdata { } 1;
Direct Responses: 5599 | Write a response