Location: PHPKode > scripts > PalmDesktop > cvt_adrbook.php
<?php
/**
 * Convert palm address book files to XML files
 * @author CPKS
 * @version 0.1
 * @package palmdata
 */

require 'adrbookfile.php';

/**
 * XML dump name.dat to name.xml
 * @param string $filename
 */
function cvt_adrbook($filename) {
  $outfile = pathinfo($filename);
	$outfile = $outfile['dirname'] . '/' . $outfile['filename'] . '.xml';
  $pf = new palmdata\addressbookFile($filename);
	$x = new \XMLWriter;
	$x->openURI($outfile);
	$x->setIndent(TRUE);
	$pf->xdump($x, 'addressbook', 'contacts');
}

$progname = array_shift($argv);

while ($fn = array_shift($argv)) {
  try {
		cvt_adrbook($fn);
		echo 'converted ', basename($fn), PHP_EOL;
	}
	catch (\Exception $e) {
	  echo "Exception caught whilst processing $fn:\n";
		echo $e->getMessage();
	}
}
Return current item: PalmDesktop