Se ha denunciado esta presentación.
Se está descargando tu SlideShare. ×

Mashups with Drupal and QueryPath

Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Cargando en…3
×

Eche un vistazo a continuación

1 de 34 Anuncio

Mashups with Drupal and QueryPath

Descargar para leer sin conexión

QueryPath provides a jQuery-like tool in PHP. Use it to work with local files, or with remote web services. This presentation illustrates how QueryPath can be used to build elaborate multi-source mash-ups in Drupal.

QueryPath provides a jQuery-like tool in PHP. Use it to work with local files, or with remote web services. This presentation illustrates how QueryPath can be used to build elaborate multi-source mash-ups in Drupal.

Anuncio
Anuncio

Más Contenido Relacionado

Presentaciones para usted (20)

Similares a Mashups with Drupal and QueryPath (20)

Anuncio

Más reciente (20)

Mashups with Drupal and QueryPath

  1. 1. Web Services, Mashups, & QueryPath Drupal Camp WI, 2009
  2. 2. Matt Butcher First web app: 1995 About a dozen languages Five books, dozens of articles Milkshake problem
  3. 3. 2009 2004
  4. 4. What We’ll Cover • QueryPath: What it is and how it works. • Web services and QueryPath • QueryPath in Drupal • Mashing Stuff Up
  5. 5. A PHP library designed to make working with XML, HTML, and HTTP simple, powerful, and robust
  6. 6. What are people doing with QueryPath?
  7. 7. Designer/Developer Dilemma • Designers create HTML that is pixel perfect • Developers are charged with taking design and turning it into a web tool. • But developers don’t have the designer’s skillset.
  8. 8. TweetyPants.com
  9. 9. Bridge Layers • Data silos are bad, repositories are good • Import and export • Information is shared using XML
  10. 10. Parsing ODT Files <?php require 'QueryPath/QueryPath.php'; $odt = 'zip://o.odt#content.xml'; foreach(qp($odt, 'text|h') as $i) { print $i->text() . quot;nquot;; }
  11. 11. Web Services Flickr, YouTube, Amazon, Twitter, e- Commerce providers, Calias, OpenAmplify, DBPedia, MusicBrainz, Technorati... REST, SOAP, XML-RPC, Linked Data, SPARQL...
  12. 12. Simplicity
  13. 13. The Task Find all <a></a> tags who have the ancestor <div></div>
  14. 14. The DOM API • At least seventeen classes, each with dozens of methods. • Complex data structure. • Checkered history in PHP. • VERY powerful.
  15. 15. 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 DOM Example
  16. 16. SAX / Expat Same size, fewer features • Event based. • Write your own parser handler. • One per XML format. • Only reliable “legacy” library.
  17. 17. QueryPath • Compact library. • Functions are short and mnemonic. [This space intentionally left blank ] • The power of DOM, but simpler than SimpleXML • (Shhh... don’t tell, but it’s built on the DOM.)
  18. 18. Anatomy of a QueryPath
  19. 19. Powerful
  20. 20. The Features • Query a document • Access remote data • With XPath • Extensions for... • CSS selectors • Advanced XML manipulation (XSLT, • Move around inside the XSD, PI) document • SQL database access • Modify the document • Templates • Access local files
  21. 21. CSS 3 Selectors Source: “Using the QueryPath PHP Library.” Matt Butcher. IBM developerWorks. Mar. 28, 2009 Use CSS Selectors (like in stylesheets) or XPath queries
  22. 22. Traversing an HTML or XML Document There are over a dozen functions for traversing a document. These are similar to jQuery’s traversal functions.
  23. 23. Manipulating a Document • Get and set text, elements, attributes, etc. • Move, clone, delete. • Build arbitrary XML or HTML.
  24. 24. Work with local or remote sources • HTML • SPARQL • SVG images • SOAP • RSS or Atom • Open Office docs • Flickr • DBPedia • Twitter • MusicBrainz • RDF/Linked Data • ...
  25. 25. Extensibility • One library cannot provide everything. • But it can provide an extension mechanism. • Developers can integrate their own code easily. • You provide the kitchen sink.
  26. 26. Built-in Extensions • QPDB: QueryPath SQL Database layer • QPTPL: Template support for QueryPath • QPXML: Extensions for serious XML hacking • More...
  27. 27. Twitter Search Ten Lines of Code
  28. 28. Drupal Module
  29. 29. The Kewpie Demo • QueryPath module • QP Cache module • Amplify module • QP Services module
  30. 30. Demos Instant Portal video: http://www.youtube.com/watch?v=GBBKPIva1tM Twitter Rating (TweetyPants): http://tweetypants.com
  31. 31. Learn More • QueryPath.org • Technosophos.com • IBM developerWorks • Drupal.org/project/... • querypath • amplify • qpservices
  32. 32. Questions? Matt Butcher http://twitter.com/technosophos http://technosophos.com

Notas del editor

































×