16 |
use File::Path qw/make_path/; |
use File::Path qw/make_path/; |
17 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
18 |
use YAML; |
use YAML; |
19 |
|
use JSON; |
20 |
|
|
21 |
|
|
22 |
=head1 NAME |
=head1 NAME |
90 |
# Croatian ISO-8859-2 characters to unaccented equivalents |
# Croatian ISO-8859-2 characters to unaccented equivalents |
91 |
#TranslateCharacters ¹©ðÐèÈæƾ® ssddcccczz |
#TranslateCharacters ¹©ðÐèÈæƾ® ssddcccczz |
92 |
|
|
93 |
|
# store data into index |
94 |
|
PropertyNames data |
95 |
|
|
96 |
# disable output |
# disable output |
97 |
ParserWarnLevel 0 |
ParserWarnLevel 0 |
149 |
|
|
150 |
my $xml = qq{<xml>}; |
my $xml = qq{<xml>}; |
151 |
|
|
152 |
|
my $data; |
153 |
|
|
154 |
foreach my $tag (@tags) { |
foreach my $tag (@tags) { |
155 |
|
|
156 |
my $r = ref $ds->{$tag}->{$type}; |
my $r = ref $ds->{$tag}->{$type}; |
164 |
$xml .= qq{<$tag><![CDATA[$vals]]></$tag>}; |
$xml .= qq{<$tag><![CDATA[$vals]]></$tag>}; |
165 |
|
|
166 |
$self->{stats}->{attr}->{$tag}++; |
$self->{stats}->{attr}->{$tag}++; |
167 |
|
|
168 |
|
$data->{$tag} = $vals; |
169 |
} |
} |
170 |
|
|
171 |
|
# serialize to JSON instead of YAML because we will loose whitespace |
172 |
|
$data = to_json($data); |
173 |
|
$xml .= qq{<data><![CDATA[$data]]></data>}; |
174 |
|
|
175 |
$xml .= qq{</xml>\n}; |
$xml .= qq{</xml>\n}; |
176 |
|
|
177 |
my $len = length($xml); |
my $len = length($xml); |
181 |
print $fh "Path-Name: $uri\nContent-Length: $len\nDocument-Type: XML\n\n$xml" or |
print $fh "Path-Name: $uri\nContent-Length: $len\nDocument-Type: XML\n\n$xml" or |
182 |
die "can't add $uri: $@\n$xml"; |
die "can't add $uri: $@\n$xml"; |
183 |
|
|
184 |
|
warn "$xml\n"; |
185 |
|
|
186 |
return 1; |
return 1; |
187 |
} |
} |
188 |
|
|