Hi
This is the best parser I've come across. Very handy and easy to use. I hope the person who wrote it will come forward so that he can get the credit he deserves (GPL or no GPL).
I added two functions so that the XML can be read from an external URL. URL to string and URL to array.

(For some reason Eclipse decided the whole module needs to be patched)

Comments

greg.harvey’s picture

Thanks for the patch. Needs testing, but as soon as it's either tested by me or someone else I'm happy to commit. =)

xjm’s picture

Patch didn't apply, but here's the function:

/**
 * This function receives the URL to an external XML document and 
 * returns the contents of the document as a string.
 * 
 * @param $file 
 * (string) URL to an external XML file.
 * 
 * @return
 * (string) The contents of the XML file as a string ready
 * to be parsed or FALSE if the file could not be retrieved.
 */
function xml_parser_load_url_xml($url) {
  $response = drupal_http_request($url);   
  // if there was an error handle it
  if ($response->code != 200) {
    watchdog('xml_parser', t('Could not retrieve XML file from: '.$url), array(), WATCHDOG_ERROR);
    return FALSE;
  }
  else {     
    $str = $response->data;
    return $str;
  }
}

I'll test it and see if it works for me. :)

xjm’s picture

StatusFileSize
new1.06 KB

Works just fine. Here's a reroll in current patch format with a little bit of coding standards cleanup.

greg.harvey’s picture

Thanks! Will check it out.

greg.harvey’s picture

Status: Needs review » Fixed

Committed to 6.x-1.x-dev. Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.