Class REXML::QuickPath
In: rexml/quickpath.rb
Methods
attribute    axe    each    filter    first    function    match    method_missing    name    parse_args    predicate   
Included modules
Functions
Public Class methods
first(element, path, namespaces=EMPTY_HASH)
each(element, path, namespaces=EMPTY_HASH, &block)
match(element, path, namespaces=EMPTY_HASH)
filter(elements, path)

Given an array of nodes it filters the array based on the path. The result is that when this method returns, the array will contain elements which match the path

与えられたノードの配列にpathに基づいてフィルターをかけます。 このメソッドがreturnして来たとき、結果はpathにマッチした要素を含 む配列になるでしょう。

axe( elements, axe_name, rest )
predicate( elements, path )

A predicate filters a node-set with respect to an axis to produce a new node-set. For each node in the node-set to be filtered, the PredicateExpr is evaluated with that node as the context node, with the number of nodes in the node-set as the context size, and with the proximity position of the node in the node-set with respect to the axis as the context position; if PredicateExpr evaluates to true for that node, the node is included in the new node-set; otherwise, it is not included.

A PredicateExpr is evaluated by evaluating the Expr and converting the result to a boolean. If the result is a number, the result will be converted to true if the number is equal to the context position and will be converted to false otherwise; if the result is not a number, then the result will be converted as if by a call to the boolean function. Thus a location path para[3] is equivalent to para[position()=3].

predicateは新しいノードセットをつくり出すための軸になる点ととも に、ノードセットをフィルターにかけます。フィルターにかけられたノー ドセットの各ノードのために、PredicateExprは、コンテキストノード としてのノード、コンテキストサイズとしてノードセットのノードの数、 そして、コンテキストの位置としての軸上の点に関するノードセットの 中のノードの位置の近似に関する評価をされます。

PredicateExprは式と結果のブーリアン(boolean)への変換を評価するこ とによって評価されます。もし、結果が数で、数がコンテキストの位置 と等しいと、結果はtrueに変換されます。そうでないときは、結果は falseに変換されるでしょう。;もし、結果が数でないときは、まるでブー リアン(boolean)の関数を呼んでいるように変換されるでしょう。この ように、位置を指定するpath para[3]はpara[position()=3]と同等です。

attribute( name )
name()
method_missing( id, *args )
function( elements, fname, rest )
parse_args( element, string )