Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
Import and Export Plug-ins
(section)
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=Exporting= So now we have imported our EPrint from this OPF format we need to be able to put it back into this format for exporting, this has the advantage that you can also export ALL other eprints in this format. We did most of the work on the importing so now it's your turn below is the basis of the Export plug-in which you can use to get started. To give you a clue this export plug-in needs to be located in lib/plugins/EPrints/Plugin/Export/OPFXML.pm package EPrints::Plugin::Export::OPFXML; use EPrints::Plugin::Export::XMLFile; @ISA = ( "EPrints::Plugin::Export::XMLFile" ); use strict; sub new { my( $class, %opts ) = @_; my $self = $class->SUPER::new( %opts ); $self->{name} = "Open Packaging Format XML"; # This plug-in can only output a single eprint record, no lists or other types of objects $self->{accept} = [ 'dataobj/eprint' ]; $self->{visible} = "all"; # Specify the mimetype so we can use an HTTP ACCEPT header to get this back. $self->{mimetype} = "application/oebps-package+xml; charset=utf-8"; # Again specify what we are exporting $self->{xmlns} = "http://www.idpf.org/2007/opf"; $self->{schemaLocation} = "http://www.idpf.org/2007/opf"; return $self; } # Method which is called to output the eprint, we would have output_list if we could handle lists sub output_dataobj { my( $plugin, $dataobj ) = @_; my $xml = $plugin->xml_dataobj( $dataobj ); return "<?xml version='1.0' encoding='UTF-8'?>" . EPrints::XML::to_string( $xml ); } # The method which actually does the work sub xml_dataobj { my( $plugin, $eprint ) = @_; my $repo = $plugin->{repository}; my $package = $repo->make_element("package", xmlns=>"http://www.idpf.org/2007/opf", "unique-identifier"=>"EPB-UUID", version=>"2.0"); my $metadata = $repo->make_element("metadata", "xmlns:opf"=>"http://www.idpf.org/2007/opf", "xmlns:dc"=>"http://purl.org/dc/elements/1.1/"); $package->appendChild($metadata); my $title = $repo->make_element("dc:title"); $title->appendText($eprint->value("title")); $metadata->appendChild($title); if( $eprint->exists_and_set( "creators" ) ) { foreach my $name ( @{ $eprint->get_value( "creators" ) } ) { # given name first my $creator = $repo->make_element("dc:creator"); $creator->appendText(EPrints::Utils::make_name_string( $name->{name}, 1 )); $metadata->appendChild($creator); } } return $package; } 1; '''Don't forget to add the line to enable the EXPORT::OPFXML in the packages config file''' This is no where near as complete as the original input from above, can you make the 2 match? ==Testing== This is an easy one. * Find the eprint you imported * Click the Actions Tab * Locate the Export options at the bottom of this tab * Find your export plug-in (by name) and click it
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)