Apache::XPointer::XPath - mod_perl handler to address XML fragments using XPath.
<Directory /foo/bar> <FilesMatch "\.xml$"> SetHandler perl-script PerlHandler Apache::XPointer::XPath PerlSetVar XPointerSendRangeAs "multipart/mixed" </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=x-urn:example")xpointer(*//x:thingy))); $req->header("Accept" => qq(application/xml, multipart/mixed)); my $res = $ua->request($req);
Apache::XPointer is a mod_perl handler to address XML fragments using the HTTP 1.1 Range and Accept headers and the XPath scheme, as described in the paper : 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 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.
Return matches as one of the following content-types :
multipart/mixed
--match Content-type: text/xml; charset=UTF-8 <foo xmlns="x-urn:example:foo" xmlns:baz="x-urn:example:baz"> <baz:bar>hello</baz:bar> </foo> --match Content-type: text/xml; charset=UTF-8 <foo xmlns="x-urn:example:foo" xmlns:baz="x-urn:example:baz"> <baz:bar>world</baz:bar> </foo> --match--
application/xml
<xp:range xmlns:xp="x-urn:cpan:ascope:apache-xpointer#" xmlns:default="x-urn:example.com"> <xp:match> <default:foo> <default:bar>hello</default:bar> </default:foo> </xp:match> <xp:match> <default:foo> <default:bar>world</default:bar> </default:foo> </xp:match> </xp:range>
Required
If set to On then the handler will check for CGI parameters as well as HTTP headers. CGI parameters are checked only if no matching HTTP header is present.
Case insensitive.
The name of the CGI parameter to check for an XPath range.
Default is range
The name of the CGI parameter to list one or more acceptable content types for a response.
Default is accept
This handler will work with both mod_perl 1.x and mod_perl 2.x.
1.1
$Date: 2004/11/16 04:38:52 $
Aaron Straup Cope <ascope@cpan.org>
Apache::XPointer
Copyright (c) 2004 Aaron Straup Cope. All rights reserved.
This is free software, you may use it and distribute it under the same terms as Perl itself.
To install Apache::XPointer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::XPointer
CPAN shell
perl -MCPAN -e shell install Apache::XPointer
For more information on module installation, please visit the detailed CPAN module installation guide.