Published on September 25, 2007
Drupal and SimpleXML
XML parsing • Very well deﬁned, well known standards • Excellent support ... • ... in most other languages • Long-standing PHP weakness (up to version 4)
two main models
Simple API for XML • Stream - based xml parsing • Event - driven API • Uni-directional
Other key concepts • Namespaces: Allow extending existing XML documents • XPath: selector syntax for addressing parts of a document • XSLT: “template” language for transforming XML documents into other formats
DOM in PHP • http://php.net/domxml • Traditionally required external libraries and additional PHP compile ﬂags • Has been removed from PHP core in PHP5 (available as a PECL module) • not really an option for Drupal core
SAX in PHP • Available in PHP 4 & PHP 5 ( --with-xml ) • Closest “built-in” support • (hence what we use in Drupal) • http://php.net/xml
SAX example (cont.)
SAX example (cont)
SAX example (cont)
SAX drawbacks • Awkward maintain state across events • Requires prior knowledge of the document • Maybe not so simple (lots to code)
SimpleXML • DOM-based processing - including xpath • Included in PHP5 • And, um, it’s simple
SimpleXML + drupal_http_request() ftw
When SimpleXML isn’t simple
maybe it’s not so bad
XML Writing example
Advantages for Drupal • Shorter, cleaner code (think cleaner aggregator.module, etc) • Manipulatable DOM structure (think hook_xml_alter) • XML Writing (think node_feed, etc)
One of the biggest advantages to the PHP 5 for Drupal 7 will be taking advantage PHP's Simple XML extension. SimpleXML is, as advertised, much simpler than ...
... http://www.slideshare.net/walkah/2007-barcelona-drupalcon-drupal-and ... Drupal and SimpleXML. ... Drupal and PHP 5; Drupal and SimpleXML; Drupal as ...
Drupalcon Barcelona was a huge success, ... Drupal and SimpleXML; Drupal as Web business ... presentations and sponsors for Drupalcon Barcelona 2007 ...
Here are some reports from DrupalCon Barcelona! We had representatives of uk/nl, hungary, be, indybay & beirut imc present -- the conference as a whole had ...
DrupalCon Barcelona 2007. Accommodation; Schedule; Sponsors; FAQ; Discuss; About; Home. Schedule. ... Drupal and SimpleXML: walkah:
DrupalCon Barcelona: Best DrupalCon Ever! ... (again!) talking about SimpleXML. ... Barcelona; Drupal; DrupalCon;
View 235 Simplexml posts, presentations, experts, and more. Get the professional knowledge you need on LinkedIn. LinkedIn Home What is LinkedIn? Join Today
2007 Barcelona Drupalcon Image handling. 6 months ago. ... 2007 Barcelona Drupalcon: Drupal and SimpleXML. 6 months ago. Technology. Your Blog is Your ...