Login   Register  
PHP Classes
elePHPant
Icontem

File: cvt_datebook.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of CPK Smithies  >  Palm Desktop  >  cvt_datebook.php  >  Download  
File: cvt_datebook.php
Role: Example script
Content type: text/plain
Description: Demonstrate conversion of datebook files to XML
Class: Palm Desktop
Convert Palm Desktop files to other formats
Author: By
Last change:
Date: 2012-10-06 22:08
Size: 797 bytes
 

Contents

Class file image Download
<?php
/**
 * Convert palm datebook files to XML files
 * @author CPKS
 * @version 1.0
 * @package palmdata
 */
require 'datebookfile.php';

/**
 * Dump file.dat to file.xml
 * @param string $filename
 */
function cvt_datebook($filename) {
  
$outfile pathinfo($filename);
    
$outfile $outfile['dirname'] . '/' $outfile['filename'] . '.xml';
  
$pf = new palmdata\datebookFile($filename);
    
$x = new \XMLWriter;
    
$x->openURI($outfile);
    
$x->setIndent(TRUE);
    
$pf->xdump($x);
}

$progname array_shift($argv);
palmdata\datebookFile::register_event_class('palmdata\xcalitem');

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