Login   Register  
PHP Classes
elePHPant
Icontem

File: cvt_memopad.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_memopad.php  >  Download  
File: cvt_memopad.php
Role: Example script
Content type: text/plain
Description: Demonstration: converts memopad files to XML
Class: Palm Desktop
Convert Palm Desktop files to other formats
Author: By
Last change:
Date: 2012-10-06 22:07
Size: 745 bytes
 

Contents

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

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

$progname array_shift($argv);

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