Apache-XPointer

 view release on metacpan or  search on metacpan

lib/Apache/XPointer.pm  view on Meta::CPAN

# $Id: XPointer.pm,v 1.13 2004/11/16 03:56:18 asc Exp $
use strict;

package Apache::XPointer;

$Apache::XPointer::VERSION = '1.1';

=head1 NAME

Apache::XPointer - mod_perl handler to address XML fragments.

=head1 SYNOPSIS

 <Directory /foo/bar>

  <FilesMatch "\.xml$">
   SetHandler	perl-script
   PerlHandler	Apache::XPointer::XPath

   PerlSetVar   XPointerSendRangeAs    "application/xml"
  </FilesMatch>

 </Directory>

 #

 my $ua  = LWP::UserAgent->new();
 my $req = HTTP::Request->new(GET => "http://example.com/foo/bar/baz.xml");

 $req->header("Range"  => qq(xmlns("x=http://example.com#")xpointer(*//x:thingy)));
 $req->header("Accept" => qq(application/xml));

 my $res = $ua->request($req);

=head1 DESCRIPTION

Apache::XPointer is a mod_perl handler to address XML fragments using
the HTTP 1.1 I<Range> and I<Accept> headers and the XPath scheme, as described
in the paper : I<A Semantic Web Resource Protocol: XPointer and HTTP>.

Additionally, the handler may also be configured to recognize a conventional
CGI parameter as a valid range identifier.

If no 'range' property is found, then the original document is
sent unaltered.

If an I<Accept> header is specified with no corresponding match, then the
server will return (406) HTTP_NOT_ACCEPTABLE. Successful queries will return
(206) HTTP_PARTIAL_CONTENT.

=head1 IMPORTANT

This package is a base class and not expected to be invoked
directly. Please use one of the scheme-specific handlers instead.

=head1 SUPPPORTED SCHEMES

=head2 XPath

Consult L<Apache::XPointer::XPath>

=head2 RDF Data Query Language (RDQL)

Consult L<Apache::XPointer::RDQL>

=head1 MOD_PERL COMPATIBILITY

This handler will work with both mod_perl 1.x and mod_perl 2.x.

=cut

require 5.6.0;
use mod_perl;

use constant MP2 => ($mod_perl::VERSION >= 1.99) ? 1 : 0;

BEGIN {

     if (MP2) {
         require Apache2;
         require Apache::RequestRec;
         require Apache::RequestIO;
         require Apache::RequestUtil;
         require Apache::Const;
         require Apache::Log;
         require Apache::URI;
         require APR::Table;
         require APR::URI;



( run in 0.892 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )