From: Petr P. <pa...@us...> - 2003-03-14 16:37:48
|
Update of /cvsroot/perl-xml/XML-LibXML-XPathContext In directory sc8-pr-cvs1:/tmp/cvs-serv29535 Modified Files: XPathContext.pm Log Message: added documentation for registerFunctionNS and registerFunction Index: XPathContext.pm =================================================================== RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/XPathContext.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- XPathContext.pm 14 Mar 2003 16:23:51 -0000 1.3 +++ XPathContext.pm 14 Mar 2003 16:37:45 -0000 1.4 @@ -102,12 +102,16 @@ my $xc = XML::LibXML::XPathContext->new($node); $xc->registerNs($prefix, $namespace_uri); + $xc->registerFunction($name, sub { ... }); + $xc->registerFunctionNS($name, $namespace_uri, sub { ... }); + $xc->registerVariableLookup(sub { ... },$data); my @nodes = $xc->findnodes($xpath); my $nodelist = $xc->findnodes($xpath); my $result = $xc->find($xpath); my $value = $xc->findvalue($xpath); + =head1 DESCRIPTION This module augments XML::LibXML by providing Perl interface to @@ -141,6 +145,22 @@ Returns the data associated with a variable lookup function during a previous call to I<registerVarLookupFunc>. + +=item B<registerFunctionNS($name, $uri, $callback)> + +Registers an extension function I<$name> in I<$uri> +namespace. I<$callback> must be a CODE reference. The arguments of the +callback function are either simple scalars or XML::LibXML::NodeList +objects depending on the XPath argument types. The function is +responsible for checking the argument number and types. Result of the +callback code must be a single value of the following types: a simple +scalar (number,string) or an arbitrary XML::LibXML object that can be +a result of findnodes: Boolean, Literal, Number, Node (e.g. Document, +Element, etc.), or NodeList. + +=item B<registerFunction($name, $callback)> + +Same as I<registerFunctionNS> but without a namespace. =item B<findnodes($xpath)> |