--- trunk/all2xml.pl 2003/02/23 07:53:01 32
+++ trunk/all2xml.pl 2003/02/23 15:47:40 35
@@ -78,7 +78,9 @@
my $swish_data = "";
my $display_data = "";
- my $line_delimiter = "";
+ my $line_delimiter;
+
+ my ($swish,$display);
foreach my $x (@{$config->{indexer}->{$field}->{isis}}) {
@@ -101,9 +103,15 @@
($s,$d,$i) = (0,0,1) if (lc($x->{type}) eq "index");
#print STDERR "## s: $s d: $d i: $i ## $format ##\n";
- $display_data .= $line_delimiter if ($display_data && $display_data !~ /$line_delimiter$/);
+ # what will separate last line from this one?
+ if ($display_data && $x->{append} && $x->{append} eq "1") {
+ $line_delimiter = ' ';
+ } elsif ($display_data) {
+ $line_delimiter = '
';
+ }
- my ($swish,$display) = (1,1);
+ # init vars so that we go into while...
+ ($swish,$display) = (1,1);
while ($swish || $display) {
($swish,$display) = parse_format($format,$row,$isis_i++);
@@ -130,6 +138,10 @@
# type="display" ; field for display
if ($d && $display) {
+ if ($line_delimiter && $display_data) {
+ $display_data .= $line_delimiter;
+ undef $line_delimiter;
+ }
if ($filter) {
no strict 'refs';
$display_data .= join($delimiter,&$filter($display));
@@ -155,21 +167,13 @@
}
}
}
- if ($x->{append}) {
- $line_delimiter = ' ';
- } else {
- $line_delimiter = '
';
- }
}
#print STDERR "s_d: $swish_data\nd_d: $display_data\n" if ($swish_data);
if ($display_data) {
- # remove last
- $display_data =~ s/$line_delimiter$//;
-
- $display_data = $isis_codepage->convert($display_data) || die "Can't convert '$display_data' !";
+# $display_data = $isis_codepage->convert($display_data) || die "Can't convert '$display_data' !";
# FIX: this is removed and replaced by html tag.
#$xml .= xmlify($field."_display", $display_data);
@@ -190,7 +194,6 @@
}
if ($field_name) {
$html .= $xml_codepage->convert($field_name);
-# $html .= "-->".$field_name."<--";
}
$html .= $display_data."###\n";
}
@@ -271,6 +274,7 @@
if (my $xml = isis2xml($row,$add_xml)) {
#print STDERR "--ret-->$xml\n";
+ use bytes; # as opposed to chars
print "Path-Name: $path#".int($row->{mfn})."\n";
print "Content-Length: ".(length($xml)+1)."\n";
print "Document-Type: XML\n\n$xml\n";