Jonathan, Many thanks. I get no errors on the command line or in the error log when I run the script. The file just executes with no output. If you have the time to run it, I've included the scriupt below, and have attached the name authority record it tries to process:
#! /usr/bin/perl use strict; use MARC::Record; use MARC::Batch; use MARC::File::XML; use constant MAX => 20; MARC::File::XML->default_record_format('UNIMARCAUTH'); my $batch = MARC::Batch->new( 'XML', 'name_authority_file'); while (my $record = $batch->next()) { for my $field ($record->field("100")){ my $name= $field->subfield('a'); print "$name", "\n"; } } I think you're right about the LOC files -- they probably got the extra spaces by accident. That's easy enough to fix. As far as the name authorities go, if I can't get MARC::File::XML to process them, I can always use XML::Tokeparser. Not as elegant, but it would get the job done. - Chris -----Original Message----- From: Jonathan Gorman [mailto:[EMAIL PROTECTED] Sent: Monday, June 09, 2008 4:43 PM To: Christopher Morgan; perl4lib@perl.org Subject: Re: Can't parse MARC Authority XML files with mx: prefixes in their tags >However, I'm having trouble parsing the name authority records online >at http://alcme.oclc.org/eprintsUK/index.html [snipped code examples] > >There are "mx:" prefixes in all the tags. What format is this? Is there >any way I can get MARC::File::XML to parse these files? The prefixes are the namespace. The parser should be able to handle this, but I don't honestly know if it does it correctly. What also might be the problem is the second namespace in there. It might help us if you included some information about what is not working (what error are you getting etc). I don't have the time right now to run my own test, but actual error messages might provide some clue. >A related question: When I first tried to process the subject authority >files from the LOC (in my first example, above), the program complained >that the "Leader must be 24 bytes long". Right, that comes from the MARC specification, there are 24 bytes. >XML files are five years old. I wonder if the XML spec has changed >since >then?) Doubt it, again it doesn't have anything really to do with the XML spec but the underlying xml record. More likely it is some error in creating the files. Can't give any more info though, sorry. Jon Gorman
name_authority_file
Description: Binary data