Ruby/XPATH

Copyright © 2004, 2005 Gregoire Lejeune <[email protected]>

Ruby/XPATH is freely distributable according to the terms of the GNU General Public License (see the file ‘COPYING’).

This program is distributed without any warranty. See the file ‘COPYING’ for details.


Documentation


XML::XPATH - A Ruby class for XPATH

SYNOPSIS

require ‘xml/xpath’ xpath = XML::XPATH.new() xpath.xmlfile = “/path/to/myfile.xml” i = xpath.execute( “/my/xpath/expression/*” ) print “#i nodes :n” p xpath.to_a

METHODS

XML::XPATH.new()

Returns a new XPATH object

XML::XPATH.xml=<xml-string | xml-filename | XML::Simple::Dom>

Set XML document

XML::XPATH.xmlfile= Set XML file XML::XPATH.xml

Get XML document or file

XML::XPATH.execute( … )

Processes the given XPATH request.
Returns the number of nodes.

XML::XPATH.to_a

Returns an array of finded nodes via execute.