【发布时间】:2021-09-19 15:48:57
【问题描述】:
以下代码解析一个简单的test.xml:
my $twig = XML::Twig->new();
my $file = 'test.xml';
my $Hash = $twig->parsefile($file)->simplify();
print Dumper($Hash);
test.xml:
<entry>
<string>SYNMAKE_LOCATION</string>
<string/>
</entry>
输出:
$VAR1 = {
'string' => [
{}
]
};
预期的输出是:
$VAR1 = {
'string' => [
'SYNMAKE_LOCATION',
{}
]
};
谁能帮我找出我的代码有什么问题?
【问题讨论】:
-
Perl 哈希不是 JSON。我已经删除了相应的标签和措辞,它们具有误导性。