<!DOCTYPE ead PUBLIC "+//ISBN 1-931666-00-8//DTD ead.dtd (Encoded Archival Description (EAD) Version 2002)//EN" "http://lcweb2.loc.gov/xmlcommon/dtds/ead2002/ead.dtd">
--
You received this message because you are subscribed to the Google Groups "ICA-AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To post to this group, send email to ica-ato...@googlegroups.com.
Visit this group at http://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/850a630d-651f-4415-a562-010b1808dabe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/perl
print "\n\n## Välkommen till VisualArkiv-till-AtoM-EADxml-manglaren v.1.0 ##\n\n Välj xml-fil att splitta: "; ## här stoppar man in xmlfilen som genererats av Visual, och sen chompar etc.
$file=<>; #Läs in filnamn, välj alltså xml-filen du genererat i Visual Arkiv 6.2 genom att "exportera till EAD (ARKIS)"
print "\n\n Du valde $file";
chomp $file;
open(FI,$file) or die "Kunde ej öppna input-filen";
$cur=0; # För att räkna output-filerna
open(FO,">$file" . "-part.$cur.xml") or die; # Öppna första output-filen och döp den efter input
while(<FI>) # Loopa igenom varje linje i inputfilen
{
print FO $_; ## skriver till output den innevarande linjen
if(/^\s*<\/ead>/) ## loopar tills den stöter på </ead>, då ska den stänga och börja ny fil
{
close(FO);
$cur++;
open(FO,">$file" . "-part.$cur.xml") or die; ## öppnar här ny fil för nästa iteration av loopen
## nedan lägger jag till doctypen till varje output-fil, förutom den första (eftersom den öppnas utanför loopen)
print FO '<?xml version="1.0" encoding="iso-8859-1"?>'. "\n" .'<!DOCTYPE ead PUBLIC "+//ISBN 1-931666-00-8//DTD ead.dtd (Encoded Archival Description (EAD) Version 2002)//EN" "http://lcweb2.loc.gov/xmlcommon/dtds/ead2002/ead.dtd">'. "\n";
print "Genererat $file" . "-part.$cur.xml\n";
}
}
print "$cur filer har skapats.\n\n";
close(FO);
Let us know if you have further questions!
Regards,
--
You received this message because you are subscribed to the Google Groups "ICA-AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To post to this group, send email to ica-ato...@googlegroups.com.
Visit this group at http://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/25eb0284-5a13-482a-acff-45f89170853f%40googlegroups.com.