Skip to content
This repository
Browse code

Fix for XML encoding in Relationship links. Close #31.

  • Loading branch information...
commit ad43369f10603aa948938a160dedcbe17ca4be32 1 parent 5628ad6
John McNamara authored September 27, 2012
2  lib/Excel/Writer/XLSX/Package/Relationships.pm
@@ -187,7 +187,7 @@ sub _write_relationship {
187 187
 
188 188
     push @attributes, ( 'TargetMode' => $target_mode ) if $target_mode;
189 189
 
190  
-    $self->xml_empty_tag( 'Relationship', @attributes );
  190
+    $self->xml_encoded_empty_tag( 'Relationship', @attributes );
191 191
 }
192 192
 
193 193
 
68  t/regression/escapes04.t
... ...
@@ -0,0 +1,68 @@
  1
+###############################################################################
  2
+#
  3
+# Tests the output of Excel::Writer::XLSX against Excel generated files.
  4
+#
  5
+# reverse('©'), January 2011, John McNamara, jmcnamara@cpan.org
  6
+#
  7
+
  8
+use lib 't/lib';
  9
+use TestFunctions qw(_compare_xlsx_files _is_deep_diff);
  10
+use strict;
  11
+use warnings;
  12
+
  13
+use Test::More tests => 1;
  14
+
  15
+###############################################################################
  16
+#
  17
+# Tests setup.
  18
+#
  19
+my $filename     = 'escapes04.xlsx';
  20
+my $dir          = 't/regression/';
  21
+my $got_filename = $dir . $filename;
  22
+my $exp_filename = $dir . 'xlsx_files/' . $filename;
  23
+
  24
+my $ignore_members  = [];
  25
+my $ignore_elements = {  'xl/workbook.xml' => ['<workbookView'] };
  26
+
  27
+
  28
+###############################################################################
  29
+#
  30
+# Test the creation of a simple Excel::Writer::XLSX file.
  31
+# Check encoding of rich strings.
  32
+#
  33
+use Excel::Writer::XLSX;
  34
+
  35
+my $workbook  = Excel::Writer::XLSX->new( $got_filename );
  36
+my $worksheet = $workbook->add_worksheet();
  37
+
  38
+$worksheet->write_url( 'A1', 'http://www.perl.com/?a=1&b=2' );
  39
+
  40
+$workbook->close();
  41
+
  42
+
  43
+###############################################################################
  44
+#
  45
+# Compare the generated and existing Excel files.
  46
+#
  47
+
  48
+my ( $got, $expected, $caption ) = _compare_xlsx_files(
  49
+
  50
+    $got_filename,
  51
+    $exp_filename,
  52
+    $ignore_members,
  53
+    $ignore_elements,
  54
+);
  55
+
  56
+_is_deep_diff( $got, $expected, $caption );
  57
+
  58
+
  59
+###############################################################################
  60
+#
  61
+# Cleanup.
  62
+#
  63
+unlink $got_filename;
  64
+
  65
+__END__
  66
+
  67
+
  68
+
BIN  t/regression/xlsx_files/escapes04.xlsx
Binary file not shown

0 notes on commit ad43369

Please sign in to comment.
Something went wrong with that request. Please try again.