[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Biblio.pm [rel_2_2]
From: |
paul poulain |
Subject: |
[Koha-cvs] koha/C4 Biblio.pm [rel_2_2] |
Date: |
Wed, 08 Mar 2006 10:49:37 +0000 |
CVSROOT: /cvsroot/koha
Module name: koha
Branch: rel_2_2
Changes by: paul poulain <address@hidden> 06/03/08 10:49:37
Modified files:
C4 : Biblio.pm
Log message:
deal with &, <, >,", ' that are not valid in a XML file.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Biblio.pm.diff?only_with_tag=rel_2_2&tr1=1.115.2.44&tr2=1.115.2.45&r1=text&r2=text
Patches:
Index: koha/C4/Biblio.pm
diff -u koha/C4/Biblio.pm:1.115.2.44 koha/C4/Biblio.pm:1.115.2.45
--- koha/C4/Biblio.pm:1.115.2.44 Wed Mar 1 17:26:08 2006
+++ koha/C4/Biblio.pm Wed Mar 8 10:49:36 2006
@@ -1040,58 +1040,60 @@
my ($tags,$subfields,$values,$indicator,$ind_tag) = @_;
use MARC::File::XML;
my $xml= MARC::File::XML::header();
- my $prevvalue;
- my $prevtag=-1;
- my $first=1;
+ my $prevvalue;
+ my $prevtag=-1;
+ my $first=1;
my $j = -1;
- for (my $i=0;$i<address@hidden;$i++){
-
- if ((@$tags[$i] ne $prevtag)){
- $j++ unless (@$tags[$i] eq "");
- warn
"IND:".substr(@$indicator[$j],0,1).substr(@$indicator[$j],1,1)."
"address@hidden;
-
- if (!$first){
- $xml.="</datafield>\n";
- $first=1;
- }
- else {
- if (@$values[$i] ne "") {
- # leader
- if (@$tags[$i] eq "000") {
- $xml.="<leader>@$values[$i]</leader>\n";
- $first=1;
- # rest of the fixed fields
- } elsif (@$tags[$i] < 10) {
- $xml.="<controlfield
tag=\"@$tags[$i]\">@$values[$i]</controlfield>\n";
- $first=1;
- }
- else {
- my $ind1 = substr(@$indicator[$j],0,1);
- my $ind2 = substr(@$indicator[$j],1,1);
- $xml.="<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\"
ind2=\"$ind2\">\n";
- $xml.="<subfield
code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
- $first=0;
- }
- }
- }
- } else {
- if (@$values[$i] eq "") {
- }
- else {
- if ($first){
- my $ind1 = substr(@$indicator[$j],0,1);
- my $ind2 = substr(@$indicator[$j],1,1);
- $xml.="<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\"
ind2=\"$ind2\">\n";
- $first=0;
+ for (my $i=0;$i<address@hidden;$i++){
+ if ((@$tags[$i] ne $prevtag)){
+ $j++ unless (@$tags[$i] eq "");
+ # deal with &, <, >,", ' that are not valid in a XML
file.
+ @$values[$i] =~ s/&/&/g;
+ @$values[$i] =~ s/</</g;
+ @$values[$i] =~ s/>/>/g;
+ @$values[$i] =~ s/"/"/g;
+ @$values[$i] =~ s/'/'/g;
+ if (!$first){
+ $xml.="</datafield>\n";
+ $first=1;
+ }
+ else {
+ if (@$values[$i] ne "") {
+ # leader
+ if (@$tags[$i] eq "000") {
+
$xml.="<leader>@$values[$i]</leader>\n";
+ $first=1;
+ # rest of the fixed fields
+ } elsif (@$tags[$i] < 10) {
+ $xml.="<controlfield
tag=\"@$tags[$i]\">@$values[$i]</controlfield>\n";
+ $first=1;
+ }
+ else {
+ my $ind1 =
substr(@$indicator[$j],0,1);
+ my $ind2 =
substr(@$indicator[$j],1,1);
+ $xml.="<datafield
tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
+ $xml.="<subfield
code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
+ $first=0;
+ }
+ }
+ }
+ } else {
+ if (@$values[$i] eq "") {
+ }
+ else {
+ if ($first){
+ my $ind1 = substr(@$indicator[$j],0,1);
+ my $ind2 = substr(@$indicator[$j],1,1);
+ $xml.="<datafield tag=\"@$tags[$i]\"
ind1=\"$ind1\" ind2=\"$ind2\">\n";
+ $first=0;
+ }
+ $xml.="<subfield
code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
+ }
}
- $xml.="<subfield
code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
-
- }
- }
- $prevtag = @$tags[$i];
+ $prevtag = @$tags[$i];
}
$xml.= MARC::File::XML::footer();
- warn $xml;
+# warn $xml;
return $xml
}
sub MARChtml2marc {
@@ -2990,8 +2992,11 @@
=cut
-# $Id: Biblio.pm,v 1.115.2.44 2006/03/01 17:26:08 kados Exp $
+# $Id: Biblio.pm,v 1.115.2.45 2006/03/08 10:49:36 tipaul Exp $
# $Log: Biblio.pm,v $
+# Revision 1.115.2.45 2006/03/08 10:49:36 tipaul
+# deal with &, <, >,", ' that are not valid in a XML file.
+#
# Revision 1.115.2.44 2006/03/01 17:26:08 kados
# Adding 'use MARC::File::XML' to routine ... needed for additem.pl to work
# for some reason. This should be fixed.
- [Koha-cvs] koha/C4 Biblio.pm [rel_2_2], Joshua Ferraro, 2006/03/01
- [Koha-cvs] koha/C4 Biblio.pm [rel_2_2], Joshua Ferraro, 2006/03/01
- [Koha-cvs] koha/C4 Biblio.pm [rel_2_2], Joshua Ferraro, 2006/03/01
- [Koha-cvs] koha/C4 Biblio.pm [rel_2_2], Joshua Ferraro, 2006/03/02
- [Koha-cvs] koha/C4 Biblio.pm [rel_2_2], Joshua Ferraro, 2006/03/04
- [Koha-cvs] koha/C4 Biblio.pm [rel_2_2],
paul poulain <=
- [Koha-cvs] koha/C4 Biblio.pm [rel_2_2], Joshua Ferraro, 2006/03/08
- [Koha-cvs] koha/C4 Biblio.pm [rel_2_2], Joshua Ferraro, 2006/03/08
- [Koha-cvs] koha/C4 Biblio.pm [rel_2_2], Joshua Ferraro, 2006/03/08