mach 2003/10/22 14:48:30
Modified: . Tag: axkit-pipeline-2 MANIFEST lib/Apache/AxKit Tag: axkit-pipeline-2 Pipeline.pm lib/Apache/AxKit/Pipeline Tag: axkit-pipeline-2 Head.pm t/conf Tag: axkit-pipeline-2 extra.last.conf.in Added: lib/Apache/AxKit/Pipeline Tag: axkit-pipeline-2 SAX.pm t Tag: axkit-pipeline-2 AxKitSaxTest.pm t/htdocs/pipeline/sax Tag: axkit-pipeline-2 01.xml 02.xml 03.xml t/htdocs/style/pipeline/sax Tag: axkit-pipeline-2 03.xsl t/pipeline Tag: axkit-pipeline-2 02sax.t Log: SAX support in pipeline. Revision Changes Path No revision No revision 1.20.2.3 +8 -0 xml-axkit/MANIFEST Index: MANIFEST =================================================================== RCS file: /home/cvs/xml-axkit/MANIFEST,v retrieving revision 1.20.2.2 retrieving revision 1.20.2.3 diff -u -r1.20.2.2 -r1.20.2.3 --- MANIFEST 20 Oct 2003 21:05:08 -0000 1.20.2.2 +++ MANIFEST 22 Oct 2003 21:48:29 -0000 1.20.2.3 @@ -163,6 +163,7 @@ lib/Apache/AxKit/Pipeline/LibXSLT.pm lib/Apache/AxKit/Pipeline/Cache.pm lib/Apache/AxKit/Pipeline/Language.pm +lib/Apache/AxKit/Pipeline/SAX.pm lib/Apache/AxKit/StyleChooser/Cookie.pm lib/Apache/AxKit/StyleChooser/FileSuffix.pm lib/Apache/AxKit/StyleChooser/PathInfo.pm @@ -217,4 +218,11 @@ t/htdocs/pipeline/cache/01.xml t/htdocs/style/pipeline/cache/01.xsl t/pipeline/01cache.t +t/pipeline/02sax.t +t/htdocs/pipeline/sax/01.xml +t/htdocs/pipeline/sax/02.xml +t/htdocs/pipeline/sax/03.xml +t/htdocs/style/pipeline/sax +t/htdocs/style/pipeline/sax/03.xsl +t/AxKitSaxTest.pm typemap No revision No revision 1.1.2.2 +19 -0 xml-axkit/lib/Apache/AxKit/Attic/Pipeline.pm Index: Pipeline.pm =================================================================== RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Attic/Pipeline.pm,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- Pipeline.pm 20 Oct 2003 20:58:01 -0000 1.1.2.1 +++ Pipeline.pm 22 Oct 2003 21:48:29 -0000 1.1.2.2 @@ -217,6 +217,25 @@ return $str } +sub send_sax{ + my ($self, $r, $parser, $pipeline ) = @_; + + $parser->set_handler( Handler => $pipeline ); + + my $result; + eval { + $result = $parser->parse_string( ${$self->get_strref( $r )} ); + }; + if($@) { + my $error = $@; + throw Apache::AxKit::Exception::Error( + -text => "SAX Error: $error" + ); + } + + return $result; +} + sub send{ my ($self, $r) = @_; No revision No revision 1.1.2.2 +30 -0 xml-axkit/lib/Apache/AxKit/Pipeline/Attic/Head.pm Index: Head.pm =================================================================== RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Pipeline/Attic/Head.pm,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- Head.pm 20 Oct 2003 20:58:01 -0000 1.1.2.1 +++ Head.pm 22 Oct 2003 21:48:29 -0000 1.1.2.2 @@ -33,6 +33,36 @@ return shift->upstream()->key( shift ); } +sub send_sax{ + my ($self, $r, $parser, $pipeline ) = @_; + + $parser->set_handler( Handler => $pipeline ); + + my $provider = $self->upstream(); + + my $result; + + eval { + my $fh = $provider->get_fh(); + $result = $parser->parse_fh($fh, $r->uri()); + }; + if ($@) { + my $xmlstring = ${$provider->get_strref()}; + undef $@; + eval { + $result = $parser->parse_string( $xmlstring ); + }; + if($@) { + my $error = $@; + throw Apache::AxKit::Exception::Error( + -text => "SAX Error: $error" + ); + } + } + + return $result; +} + sub stylesheet_exists{ 0; } sub set_stage{ No revision Index: Head.pm =================================================================== RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Pipeline/Attic/Head.pm,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- Head.pm 20 Oct 2003 20:58:01 -0000 1.1.2.1 +++ Head.pm 22 Oct 2003 21:48:29 -0000 1.1.2.2 @@ -33,6 +33,36 @@ return shift->upstream()->key( shift ); } +sub send_sax{ + my ($self, $r, $parser, $pipeline ) = @_; + + $parser->set_handler( Handler => $pipeline ); + + my $provider = $self->upstream(); + + my $result; + + eval { + my $fh = $provider->get_fh(); + $result = $parser->parse_fh($fh, $r->uri()); + }; + if ($@) { + my $xmlstring = ${$provider->get_strref()}; + undef $@; + eval { + $result = $parser->parse_string( $xmlstring ); + }; + if($@) { + my $error = $@; + throw Apache::AxKit::Exception::Error( + -text => "SAX Error: $error" + ); + } + } + + return $result; +} + sub stylesheet_exists{ 0; } sub set_stage{ No revision Index: Head.pm =================================================================== RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Pipeline/Attic/Head.pm,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- Head.pm 20 Oct 2003 20:58:01 -0000 1.1.2.1 +++ Head.pm 22 Oct 2003 21:48:29 -0000 1.1.2.2 @@ -33,6 +33,36 @@ return shift->upstream()->key( shift ); } +sub send_sax{ + my ($self, $r, $parser, $pipeline ) = @_; + + $parser->set_handler( Handler => $pipeline ); + + my $provider = $self->upstream(); + + my $result; + + eval { + my $fh = $provider->get_fh(); + $result = $parser->parse_fh($fh, $r->uri()); + }; + if ($@) { + my $xmlstring = ${$provider->get_strref()}; + undef $@; + eval { + $result = $parser->parse_string( $xmlstring ); + }; + if($@) { + my $error = $@; + throw Apache::AxKit::Exception::Error( + -text => "SAX Error: $error" + ); + } + } + + return $result; +} + sub stylesheet_exists{ 0; } sub set_stage{ 1.1.2.1 +78 -0 xml-axkit/lib/Apache/AxKit/Pipeline/Attic/SAX.pm No revision No revision 1.1.2.1 +16 -0 xml-axkit/t/Attic/AxKitSaxTest.pm No revision No revision 1.7.2.2 +26 -1 xml-axkit/t/conf/extra.last.conf.in Index: extra.last.conf.in =================================================================== RCS file: /home/cvs/xml-axkit/t/conf/extra.last.conf.in,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -u -r1.7.2.1 -r1.7.2.2 --- extra.last.conf.in 20 Oct 2003 20:58:01 -0000 1.7.2.1 +++ extra.last.conf.in 22 Oct 2003 21:48:29 -0000 1.7.2.2 @@ -22,7 +22,7 @@ } } </Perl> -AxAddStyleMap application/x-xsp Apache::AxKit::Language::XSP; +AxAddStyleMap application/x-xsp Apache::AxKit::Pipeline::XSP; ####################################### # Directives that control the individual configs @@ -142,5 +142,30 @@ PerlSetVar AxCacheDebugHeaders 1 AxResetProcessors AxAddProcessor text/xsl /style/pipeline/cache/01.xsl +</Location> + +<Location "/pipeline/sax/01.xml"> + SetHandler axkit + AxResetProcessors + AxAddStyleMap application/sax Apache::AxKit::Pipeline::SAX + AxAddProcessor application/sax 'AxKitSaxTest' +</Location> + +<Location "/pipeline/sax/02.xml"> + SetHandler axkit + AxResetProcessors + AxAddStyleMap application/sax Apache::AxKit::Pipeline::SAX + AxAddProcessor application/sax 'AxKitSaxTest' + AxAddProcessor application/sax 'AxKitSaxTest' +</Location> + +<Location "/pipeline/sax/03.xml"> + SetHandler axkit + AxResetProcessors + AxAddStyleMap application/sax Apache::AxKit::Pipeline::SAX + AxAddProcessor text/xsl /style/pipeline/sax/03.xsl + AxAddProcessor application/sax 'AxKitSaxTest' + AxAddProcessor application/sax 'AxKitSaxTest' + AxAddProcessor text/xsl /style/pipeline/sax/03.xsl </Location> No revision No revision 1.1.2.1 +2 -0 xml-axkit/t/htdocs/pipeline/sax/Attic/01.xml 1.1.2.1 +2 -0 xml-axkit/t/htdocs/pipeline/sax/Attic/02.xml 1.1.2.1 +2 -0 xml-axkit/t/htdocs/pipeline/sax/Attic/03.xml No revision No revision 1.1.2.1 +9 -0 xml-axkit/t/htdocs/style/pipeline/sax/Attic/03.xsl No revision No revision 1.1.2.1 +29 -0 xml-axkit/t/pipeline/Attic/02sax.t