function convertFile( $fileName ) {
		$this->context = SecurePoll_Context::newFromXmlFile( $fileName );
		if ( !$this->context ) {
			spFatal( "Unable to parse XML file \"$fileName\"" );
		}
		$electionIds = $this->context->getStore()->getAllElectionIds();
		if ( !count( $electionIds ) ) {
			spFatal( "No elections found in XML file \"$fileName\"" );
		}
		$electionId = reset( $electionIds );
		$this->election = $this->context->getElection( reset( $electionIds ) );
		$this->convert( $electionId );
	}
EOT;

if ( !isset( $options['name'] ) && !isset( $args[0] ) ) {
	spFatal( $usage );
}

if ( !class_exists( 'SecurePoll_Context' ) ) {
	if ( isset( $options['name'] ) ) {
		spFatal( "Cannot load from database when SecurePoll is not installed" );
	}
	require( dirname( __FILE__ ) . '/../SecurePoll.php' );
}

$context = new SecurePoll_Context;
if ( !isset( $options['name'] ) ) {
	$context = SecurePoll_Context::newFromXmlFile( $args[0] );
	if ( !$context ) {
		spFatal( "Unable to parse XML file \"{$args[0]}\"" );
	}
	$electionIds = $context->getStore()->getAllElectionIds();
	if ( !count( $electionIds ) ) {
		spFatal( "No elections found in XML file \"{$args[0]}\"" );
	}
	$election = $context->getElection( reset( $electionIds ) );
} else {
	$election = $context->getElectionByTitle( $options['name'] );
	if ( !$election ) {
		spFatal( "The specified election does not exist." );
	}
}
	/**
	 * Show a tally of the results in the uploaded file
	 */
	function submitUpload() {
		global $wgOut;
		if ( !isset( $_FILES['tally_file'] )
			|| !is_uploaded_file( $_FILES['tally_file']['tmp_name'] ) 
			|| !$_FILES['tally_file']['size'] )
		{
			$wgOut->addWikiMsg( 'securepoll-no-upload' );
			return;
		}
		$context = SecurePoll_Context::newFromXmlFile( $_FILES['tally_file']['tmp_name'] );
		if ( !$context ) {
			$wgOut->addWikiMsg( 'securepoll-dump-corrupt' );
			return;
		}
		$electionIds = $context->getStore()->getAllElectionIds();
		$election = $context->getElection( reset( $electionIds ) );

		$status = $election->tally();
		if ( !$status->isOK() ) {
			$wgOut->addWikiText( $status->getWikiText( 'securepoll-tally-upload-error' ) );
			return;
		}
		$tallier = $status->value;
		$wgOut->addHTML( $tallier->getHtmlResult() );
	}