Mike,

I think Ed Summers' message (from Dec. 17th) on the code4lib mailing list might be helpful or relevant:

    http://serials.infomotions.com/code4lib/archive/2007/200712/

I'm not familiar with these perl modules. -- If I want to try something out I tend to use a pared down version of my OaiList.pl script that I keep which is part of our OAI Toolkit:

    http://sourceforge.net/projects/umoaitoolkit/

This script just uses XML::LibXML to parse the records that are harvested and, in the released version, writes the records to a file. Instead of writing the file you can just:

    my $marcxml = $recordNode->toString(1);
    my $record   = MARC::Record->new_from_xml( $marcxml );

... and add your "good stuff" to that script.


Josh



On Apr 21, 2008, at 3:46 PM, KREYCHE, MICHAEL wrote:

I'm trying something a little new for me and, as usual, the first time
is the hardest. I'm harvesting MARC records from a repository and want
to modify them. In the past I've used LWP to retrieve raw XML, parsed
it, and turned it into a MARC structure. Now I'm trying to do things the
"right" way.

Once I've got a MARCXML record object, it seems to me there ought to be a simple way to turn it into a string and grab it, something like this:

$results = $harvester->listAllRecords( metadataPrefix => 'marc21'
);
while ( my $data = $results->next() ) {
        my $header = $data->header();
        my $metadata = $data->metadata();
        my $marcxml = ... missing link is here ...
        my $record = MARC::Record->new_from_xml( $marcxml );
        ... good stuff goes here ...
}

Or maybe there's a more direct way. Anyhow, I've looked around a bit and haven't figured out a solution, so I would be greatly obliged if someone
could point me in the right direction.

TIA,
Mike
--
Michael Kreyche
Systems Librarian / Associate Professor
Libraries and Media Services
Kent State University
330-672-1918

Reply via email to