|
Lines 144-157
if (not defined $format) {
Link Here
|
| 144 |
my $parser = XML::LibXML->new(); |
144 |
my $parser = XML::LibXML->new(); |
| 145 |
my $record_dom = $parser->parse_string( $marcxml ); |
145 |
my $record_dom = $parser->parse_string( $marcxml ); |
| 146 |
$record_dom = $transformer->transform( $record_dom ); |
146 |
$record_dom = $transformer->transform( $record_dom ); |
| 147 |
$content = $record_dom->toString(); |
147 |
$content = $transformer->output_as_chars( $record_dom ); |
| 148 |
}; |
148 |
}; |
| 149 |
if ($@) { |
149 |
if ($@) { |
| 150 |
print $cgi->header( -status => '500 internal error ' . $@->code() . ": " . $@->message() ); |
150 |
print $cgi->header( -status => '500 internal error ' . $@->code() . ": " . $@->message() ); |
| 151 |
exit 0; |
151 |
exit 0; |
| 152 |
} |
152 |
} |
| 153 |
|
153 |
|
| 154 |
print $cgi->header( -type =>'application/xml' ); |
154 |
print $cgi->header( -type =>'application/xml', -charset => 'UTF-8' ); |
| 155 |
print $content; |
155 |
print $content; |
| 156 |
} else { |
156 |
} else { |
| 157 |
# ID is obviously wrong, so 404 |
157 |
# ID is obviously wrong, so 404 |
|
Lines 172-178
sub emit_formats {
Link Here
|
| 172 |
if (defined $id) { |
172 |
if (defined $id) { |
| 173 |
print $cgi->header( -type =>'application/xml', -status => '300 multiple choices' ); |
173 |
print $cgi->header( -type =>'application/xml', -status => '300 multiple choices' ); |
| 174 |
} else { |
174 |
} else { |
| 175 |
print $cgi->header( -type =>'application/xml' ); |
175 |
print $cgi->header( -type =>'application/xml', -status => '200 Ok' ); |
| 176 |
} |
176 |
} |
| 177 |
|
177 |
|
| 178 |
print "<?xml version='1.0' encoding='utf-8' ?>\n"; |
178 |
print "<?xml version='1.0' encoding='utf-8' ?>\n"; |
| 179 |
- |
|
|