NAME
Apache::XPointer::XPath - mod_perl handler to address XML fragments using XPath.
SYNOPSIS
<Directory /foo/bar>
<FilesMatch "\.xml$">
SetHandler perl-script
PerlHandler Apache::XPointer::XPath
PerlSetVar XPointerSendRangeAs "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=x-urn:example")xpointer(*//x:thingy)));
my $res = $ua->request($req);
DESCRIPTION
Apache::XPointer is a mod_perl handler to address XML fragments using the HTTP 1.1 Range header 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.
OPTIONS
XPointerAllowCGIRange
If set to On then the handler will check the CGI parameters sent with the request for an argument defining an XPath range.
CGI parameters are checked only if no HTTP Range header is present.
Case insensitive.
XPointerCGIRangeParam
The name of the CGI parameter to check for an XPath range.
Default is range
XPointerSendRangeAs
multi-part
Returns matches as type 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--
XML
Return matches as type 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>
Default is XML; case-insensitive.
MOD_PERL COMPATIBILITY
This handler will work with both mod_perl 1.x and mod_perl 2.x; it works better in 1.x because it supports Apache::Request which does a better job of parsing CGI parameters.
VERSION
1.0
DATE
$Date: 2004/11/13 23:30:02 $
AUTHOR
Aaron Straup Cope <ascope@cpan.org>
SEE ALSO
LICENSE
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.