querypath: it's like php jquery in drupal!
DESCRIPTION
This slideshow introduces QueryPath (a PHP jQuery library)TRANSCRIPT
![Page 1: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/1.jpg)
QueryPathIt’s like PHP jQuery for Drupal
http://querypath.orghttp://api.querypath.org
Tuesday, August 17, 2010
![Page 2: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/2.jpg)
Matt ButcherMaintainer of QueryPath
Author of 6 books
Drupal developer atConsumerSearch.Com “Learning Drupal 7” will be
out in RAW this monthhttp://packtpub.com
Tuesday, August 17, 2010
![Page 3: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/3.jpg)
Emily BrandJust completed a
GSoC QueryPath project.MA in Computer Science
IT Developer/EngineerHP
Tuesday, August 17, 2010
![Page 4: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/4.jpg)
What Is QueryPath?
Tuesday, August 17, 2010
![Page 5: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/5.jpg)
A PHP library for working with HTML, XML, and
Web services.
Tuesday, August 17, 2010
![Page 6: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/6.jpg)
Follows the jQuery interfaceas much as possible.
Tuesday, August 17, 2010
![Page 7: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/7.jpg)
Why do we need it?
Tuesday, August 17, 2010
![Page 8: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/8.jpg)
The Task
Find all <a></a>
tags who havethe ancestor
<div></div>
Tuesday, August 17, 2010
![Page 9: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/9.jpg)
The DOM API
• At least seventeen classes, each with dozens of methods.
• Complex data structure.
• Checkered history in PHP.
• VERY powerful.
Tuesday, August 17, 2010
![Page 10: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/10.jpg)
SimpleXML
• One class, about a dozen functions and methods.
• Turns XML into basic objects.
• Makes easy stuff easy, and makes everything else insanely hard.
Same size as DOMExample
Tuesday, August 17, 2010
![Page 11: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/11.jpg)
SAX / Expat
• Event based.
• Write your own parser handler.
• One per XML format.
• Only reliable “legacy” library.
Same size,fewer features
Tuesday, August 17, 2010
![Page 12: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/12.jpg)
QueryPath
• Compact library.
• Functions are short and mnemonic.
• The power of DOM, but simpler than SimpleXML
• (Shhh... don’t tell, but it’s built on the DOM.)
[This space intentionally left blank ]
Tuesday, August 17, 2010
![Page 13: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/13.jpg)
Lots of Features,One function.
Tuesday, August 17, 2010
![Page 14: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/14.jpg)
• Open XML/HTML file: qp(‘somefile.xml’);
• Parse string: qp(‘<html>...</html>’);
• Get URL: qp(‘http://drupal.org');
• Use DOM or SimpleXML object: qp($ele);
Files, strings, objects...
Tuesday, August 17, 2010
![Page 15: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/15.jpg)
Search with CSS
qp($rss_url, ‘item > title’);
<?xml version="1.0" encoding="utf-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0" xml:base="http://technosophos.com"> <channel> <title>TechnoSophos</title> <link>http://technosophos.com</link> <item> <title> Drupal Dojo: "QueryPath" </title> <link>http://technosophos.com/content/...</link> <description> On August 17th at 12pm EDT (9AM PDT)... </description> </item> </channel></rss>
Tuesday, August 17, 2010
![Page 16: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/16.jpg)
Chaining (Fluent API)
Tuesday, August 17, 2010
![Page 17: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/17.jpg)
$qp = new QueryPath(‘my.xml’);$qp->find(‘root’);$qp->append(‘<p>Hi.</p>’)
Tuesday, August 17, 2010
![Page 18: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/18.jpg)
qp(‘my.xml’, ‘root’)->append(‘<p>Hi.</p>’);
Tuesday, August 17, 2010
![Page 19: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/19.jpg)
Some Things it Does• Import/Scrape HTML
• Read XML files
• Remote web services
• SVG image manipulation
• RSS or Atom feeds
• Retrieve database data into XML/HTML
• Work with RDFa
• Run SPARQL queries on Semantic Web
• Generate XML
• Transform using XSLT
• Interact with RDBMS
• And more...
Tuesday, August 17, 2010
![Page 20: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/20.jpg)
QueryPath and Drupal
Tuesday, August 17, 2010
![Page 21: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/21.jpg)
Myth“QueryPath is for Drupal”
QueryPath is a PHP library, and will work with any PHP tool.*
Tuesday, August 17, 2010
![Page 22: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/22.jpg)
FactThe QueryPath Drupal modules
provides all you need.
You can easily use QueryPath within Drupal.
http://drupal.org/project/querypath
Tuesday, August 17, 2010
![Page 23: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/23.jpg)
What’s Been Done with QueryPath?
Tuesday, August 17, 2010
![Page 24: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/24.jpg)
Honestly, I can’t keep track anymore.But here are a few examples.
Tuesday, August 17, 2010
![Page 25: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/25.jpg)
Tuesday, August 17, 2010
![Page 26: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/26.jpg)
Tuesday, August 17, 2010
![Page 27: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/27.jpg)
Tuesday, August 17, 2010
![Page 28: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/28.jpg)
Tuesday, August 17, 2010
![Page 29: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/29.jpg)
Tuesday, August 17, 2010
![Page 30: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/30.jpg)
Tuesday, August 17, 2010
![Page 31: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/31.jpg)
QueryPath 2.1
Tuesday, August 17, 2010
![Page 32: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/32.jpg)
Better HTMLUse
htmlqp() to parse HTML.
Six lines ofcode to grab
headlines fromd.o
Tuesday, August 17, 2010
![Page 33: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/33.jpg)
jQuery 1.4 Features• attach & detach
• has
• even & odd
• first & last
• firstChild & lastChild
• nextUntil, prevUntil & parentsUntil
• More...
Tuesday, August 17, 2010
![Page 34: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/34.jpg)
Tons of new documentation and examples.
Tuesday, August 17, 2010
![Page 35: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/35.jpg)
New Logo
Designed by Michael Mesker
Tuesday, August 17, 2010
![Page 36: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/36.jpg)
And the Drupal module...
Tuesday, August 17, 2010
![Page 37: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/37.jpg)
Drupal 7 version is DONE!
Tuesday, August 17, 2010
![Page 38: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/38.jpg)
Demos
Tuesday, August 17, 2010
![Page 39: QueryPath: It's like PHP jQuery in Drupal!](https://reader033.vdocuments.mx/reader033/viewer/2022051109/5479dc395806b562048b475b/html5/thumbnails/39.jpg)
• Stable: QueryPath 2.0.1http://querypath.org
• Development: QueryPath 2.1http://github.com/technosophos/querypath
• Drupal modules at http://drupal.org/project/querypath
Tuesday, August 17, 2010