xml

format_xml_elements usage

  1. /**
  2.  * Return expected Mindtouch XML format containing user details.
  3.  */
  4. function mindtouch_remote_auth_format_xml($mindtouch_user) {
  5.   $elements = format_xml_elements(array('email' => $mindtouch_

Fix for Fix for QueryPath for removing an XML item

  1. function mymodule_update_languages_xml($form, &$form_state) {
  2.     /*
  3.     ...
  4.     */
  5.     $qp = qp($file);
  6.     if ($form_state['values']['op'] == 'Delete') {
  7.       // Find only items that have id=

Fix for QueryPath for removing an XML item

  1. function mymodule_update_languages_xml($form, &$form_state) {
  2.     /*
  3.     ...
  4.     */
  5.     $qp = qp($file);
  6.     if ($form_state['values']['op'] == 'Delete') {
  7.       $qp->find('languageList')->find(

QueryPath for removing an XML item

  1. function mymodule_add_language_xml($form, &$form_state) {
  2.     /*
  3.     ...
  4.     */
  5.     $qp = qp($file);
  6.     if ($form_state['values']['op'] == 'Delete') {
  7.       $qp->find('languageList')->find('ite

Fix for xml_parser improvements

  1. <?php
  2. // $Id
  3.  
  4. /**
  5.  * This function receives the path to an XML document and
  6.  * returns the contents of the document as a string.
  7.  *
  8.  * @param $file
  9.  * (string) The system path to an XML fil

xml_parser module, example of use

  1. <?php
  2. function drivingforce_import_init() {
  3.   tester();
  4. }
  5.  
  6. function tester() {
  7.   $files = file_scan_directory(variable_get('drivingforce_import_xml_files', ''), '.*.xml', array('.', '..', 'CVS')

xml_parser improvements

  1. <?php
  2. // $Id
  3.  
  4. /**
  5.  * Function receives the path to an XML document and returns
  6.  * the contents of the document as a string.
  7.  *
  8.  * @param $file
  9.  * (string) The system path to an XML file.
  10.  *

quiz xml

  1. <quiz>
  2. <authorName>admin</authorName>
  3. <authorId>1</authorId>
  4. <title>Sample Quiz</title>
  5. <description>Just a Sample Quiz.</description>
  6. <nodeId>1</nodeId>
  7. <createDate>1244401610</createDate>
  8. <la
Rob Loach's picture

getDOM

  1. function getDOM($url) {
  2.         $ch = curl_init ();
  3.         curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  4.         curl_setopt ($ch, CURLOPT_URL, $url);
  5.         curl_setopt ($ch, CURLOPT_TIMEOUT, 10);

scrape it up

  1.   $xml = simple_get_xml('http://www.cotrip.org/atis/web.TraveltimeMarshal');
  2.   $table = $xml->xpath('/html/body/table[3]');
  3.   foreach ($table[0]->tr as $item) {
  4.     if (count($item) == 1) {
Syndicate content