/[webpac]/trunk/all2xml.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/all2xml.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 32 by dpavlin, Sun Feb 23 07:53:01 2003 UTC revision 35 by dpavlin, Sun Feb 23 15:47:40 2003 UTC
# Line 78  sub isis2xml { Line 78  sub isis2xml {
78    
79                  my $swish_data = "";                  my $swish_data = "";
80                  my $display_data = "";                  my $display_data = "";
81                  my $line_delimiter = "";                  my $line_delimiter;
82    
83                    my ($swish,$display);
84    
85                  foreach my $x (@{$config->{indexer}->{$field}->{isis}}) {                  foreach my $x (@{$config->{indexer}->{$field}->{isis}}) {
86    
# Line 101  sub isis2xml { Line 103  sub isis2xml {
103                          ($s,$d,$i) = (0,0,1) if (lc($x->{type}) eq "index");                          ($s,$d,$i) = (0,0,1) if (lc($x->{type}) eq "index");
104  #print STDERR "## s: $s d: $d i: $i ## $format ##\n";    #print STDERR "## s: $s d: $d i: $i ## $format ##\n";  
105    
106                          $display_data .= $line_delimiter if ($display_data && $display_data !~ /$line_delimiter$/);                          # what will separate last line from this one?
107                            if ($display_data && $x->{append} && $x->{append} eq "1") {
108                                    $line_delimiter = ' ';
109                            } elsif ($display_data) {
110                                    $line_delimiter = '<br/>';
111                            }
112    
113                          my ($swish,$display) = (1,1);                          # init vars so that we go into while...
114                            ($swish,$display) = (1,1);
115    
116                          while ($swish || $display) {                          while ($swish || $display) {
117                                  ($swish,$display) = parse_format($format,$row,$isis_i++);                                  ($swish,$display) = parse_format($format,$row,$isis_i++);
# Line 130  sub isis2xml { Line 138  sub isis2xml {
138    
139                                  # type="display" ; field for display                                  # type="display" ; field for display
140                                  if ($d && $display) {                                  if ($d && $display) {
141                                            if ($line_delimiter && $display_data) {
142                                                    $display_data .= $line_delimiter;
143                                                    undef $line_delimiter;
144                                            }
145                                          if ($filter) {                                          if ($filter) {
146                                                  no strict 'refs';                                                  no strict 'refs';
147                                                  $display_data .= join($delimiter,&$filter($display));                                                  $display_data .= join($delimiter,&$filter($display));
# Line 155  sub isis2xml { Line 167  sub isis2xml {
167                                          }                                          }
168                                  }                                  }
169                          }                          }
                         if ($x->{append}) {  
                                 $line_delimiter = ' ';  
                         } else {  
                                 $line_delimiter = '<br/>';  
                         }  
170                  }                  }
171    
172    
173  #print STDERR "s_d: $swish_data\nd_d: $display_data\n" if ($swish_data);  #print STDERR "s_d: $swish_data\nd_d: $display_data\n" if ($swish_data);
174                  if ($display_data) {                  if ($display_data) {
175    
176                          # remove last <br>  #                       $display_data = $isis_codepage->convert($display_data) || die "Can't convert '$display_data' !";
                         $display_data =~ s/$line_delimiter$//;  
   
                         $display_data = $isis_codepage->convert($display_data) || die "Can't convert '$display_data' !";  
177                          # FIX: this is removed and replaced by html tag.                          # FIX: this is removed and replaced by html tag.
178                          #$xml .= xmlify($field."_display", $display_data);                          #$xml .= xmlify($field."_display", $display_data);
179    
# Line 190  sub isis2xml { Line 194  sub isis2xml {
194                                  }                                  }
195                                  if ($field_name) {                                  if ($field_name) {
196                                          $html .= $xml_codepage->convert($field_name);                                          $html .= $xml_codepage->convert($field_name);
 #                                       $html .= "-->".$field_name."<--";  
197                                  }                                  }
198                                  $html .= $display_data."###\n";                                  $html .= $display_data."###\n";
199                          }                          }
# Line 271  foreach my $database ($cfg->Sections) { Line 274  foreach my $database ($cfg->Sections) {
274    
275                          if (my $xml = isis2xml($row,$add_xml)) {                          if (my $xml = isis2xml($row,$add_xml)) {
276  #print STDERR "--ret-->$xml\n";  #print STDERR "--ret-->$xml\n";
277                                    use bytes;      # as opposed to chars
278                                  print "Path-Name: $path#".int($row->{mfn})."\n";                                  print "Path-Name: $path#".int($row->{mfn})."\n";
279                                  print "Content-Length: ".(length($xml)+1)."\n";                                  print "Content-Length: ".(length($xml)+1)."\n";
280                                  print "Document-Type: XML\n\n$xml\n";                                  print "Document-Type: XML\n\n$xml\n";

Legend:
Removed from v.32  
changed lines
  Added in v.35

  ViewVC Help
Powered by ViewVC 1.1.26