This is the first official release of the Drupal QueryPath module. Along with this module, you will also need to download the QueryPath library from http://querypath.org.
The QueryPath module is a developer-centered tool. This module provides three things:
- It loads the QueryPath library on boot.
- It provides several examples of how Drupal and QueryPath can work together (see querypath_examples.module).
- It provides database integration with the Drupal database library so that you can do things like this:
<?php
// The SQL we will run:
$sql = 'SELECT title FROM {node} WHERE sticky = 1';
$ul = qp(QueryPath::HTML_STUB, 'body')
->query($sql)
->withEachRow()
->appendColumn('title', '<li/>')
->writeHTML();
?>
(That creates an HTML page containing a bulleted list of the titles of every sticky node.)
When should I use this module?
This module is good for importing XML, manipulating any XML or HTML markup (including well-formed files containing PHP), and accessing remote XML feeds. This library has been used for HTML, XHTML, RSS, Atom, Twitter API, Flickr API, RDF, and other arbitrary XML formats.
If you are looking for a library that will make dealing with XML and HTML as easy as writing a few lines of jQuery-like PHP, this is the module for you.