/usr/share/perl5/XML/XQL/Query.pod is in libxml-xql-perl 0.68-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | =head1 NAME
XML::XQL::Query - Creates an XQL query evaluater from a XQL expression
=head1 SYNOPSIS
use XML::XQL;
use XML::XQL::DOM;
$parser = new XML::DOM::Parser;
$doc = $parser->parsefile ("file.xml");
# Return all elements with tagName='title' under the root element 'book'
$query = new XML::XQL::Query (Expr => "book/title");
@result = $query->solve ($doc);
# Or (to save some typing)
@result = XML::XQL::solve ("book/title", $doc);
=head1 DESCRIPTION
To perform XQL queries on an XML::DOM document (or, in the future, on other XML
storage structures), you first have to create an XML::XQL::Query object and
pass it a valid XQL query expression. You can then perform queries on one or
more documents by calling the solve() method.
=head1 XML::XQL::Query constructor
Usage, e.g:
$query = new XML::XQL::Query(
Expr => "book/author",
Func => [ myfunc => \&my_func, # define 2 functions
myfunc2 => \&my_func2 ],
FuncArgCount => [ myfunc2 => [2, -1] ], # myfunc2 has 2 or more args
AllowedOutSideSubquery => [ myfunc => 1 ],
ConstFunc => [ myfunc2 => 1],
CompareOper => [ mycmp => \&mycmp ], # define comparison operator
q => "str"); # use str// as string delim
=over 4
=item Expr => STRING
The query expression to be evaluated.
=item NodeQuery => BOOLEAN
If set to 1, the query is a I<Node Query> as opposed to a
I<Full Query> (which is the default.)
A node query is a query that is only capable of returning Nodes.
A full query is capable of returning Node values and non-Node values.
Non-Node values include XML Primitives, element type names, namespace URI's,
concatenated text nodes, and node type names. The distinction is significant
because node queries may appear as XSL match and select patterns, while full
queries have use in other applications.
The difference between the two forms of queries is trivial and exists only as
constraints on the syntax of node queries.
Node queries may contain nested full queries.
=item Func => [ FUNCNAME => FUNCREF, ...]
Defines one or more functions. FUNCNAME is the name as used in the query
expression. FUNCREF can be either a function reference like \&my_func or
an anonymous sub.
See also: defineFunction
=item Method => [ FUNCNAME => FUNCREF, ...]
Defines one or more methods. FUNCNAME is the name as used in the query
expression. FUNCREF can be either a function reference like \&my_func or
an anonymous sub.
See also: defineMethod
=item FuncArgCount => [ FUNCNAME => ARGCOUNT, ...]
Defines the number of arguments for one or more functions or methods.
FUNCNAME is the name as used in the query expression.
See also: defineFunction and defineMethod
=item AllowedOutsideSubquery => [ FUNCNAME => BOOLEAN, ...]
Defines whether the specified function or method is allowed outside
subqueries. FUNCNAME is the name as used in the query expression.
See also: defineFunction and defineMethod
=item ConstFunc => [ FUNCNAME => BOOLEAN, ...]
Defines whether the function (not method!) is a "constant" function.
FUNCNAME is the name as used in the query expression.
See L<Constant Function Invocations> for a definition of "constant"
See also: defineFunction and defineMethod
=item CompareOper => [ OPERNAME => FUNCREF, ...]
Defines the comparison operator with the specified OPERNAME, e.g. if
OPERNAME is "contains", you can use "$contains$" in the query.
See also: defineComparisonOperators
=item q => TOKEN
Defines the q// token. See also: defineTokenQ
=item qq => TOKEN
Defines the qq// token. See also: defineTokenQQ
=item Error => FUNCREF
Defines the function that is called when errors occur during parsing the
query expression. The default function prints an error message to STDERR.
=item Debug => FLAGS
Sets the debug level for the Yapp parser that parses the query expression.
Default value is 0 (don't print anything). The maximum value is 0x17, which
prints a lot of stuff. See the Parse::Yapp manpage for the meaning of the
individual bits.
=item Reserved hash keys
Users may add their own (key, value) pairs to the Query constructor.
Beware that the key 'Tree' is used internally.
=back
=head1 XML::XQL::Query methods
=over 4
=item solve (INPUT_LIST...)
Note that solve takes a list of nodes which are assumed to be in document order
and must belong to the same document. E.g:
$query = new XML::XQL::Query (Expr => "doc//book");
@result = $query->solve ($doc);
@result2 = $query->solve ($node1, $node2, $node3);
=back
The following functions are also available at the query level, i.e. when called
on a Query object they only affect this Query and no others:
defineFunction, defineMethod, defineComparisonOperators,
defineTokenQ, defineTokenQQ
See L<Global functions|XML::XQL/XML::XQL global functions> for details.
Another way to define these features for a particular Query is by passing the
appropriate values to the XML::XQL::Query constructor.
=head1 SEE ALSO
L<XML::XQL> for general information about the XML::XQL module
L<XML::XQL::Tutorial> which describes the XQL syntax
|