このスレッドは、Perl script to populate an XML fileの続きです。Perlスクリプトを使用してXMLファイルの内容を変更する
私は変更したいファイルがある:私はこのリストには、ここで新しい国を追加したい
<?xml version="1.0" encoding="UTF-8"?>
<configuration start="earth">
<country-list>
<country name="japan">
<description></description>
<start>1900</start>
<end/>
</country>
<country name="italy">
<description></description>
<start>1950</start>
<end/>
</country>
<country name="korea">
<description></description>
<start>1800</start>
<end/>
</country>
</country-list>
</configuration>
。
前の質問では、Perl script to populate an XML fileです。
#Get the list of cities as a list, then push "Tokyo" to it.
push @{$doc->{countries}->{country}->{'japan-'}->{city}}, 'Tokyo';
これは新しいタグを追加するように提案されましたが、私の場合は「プッシュ」をどのくらい正確に使用できるかわかりません。正しいタグにマップできません。
あなたの問題は? – cjm
push @ {$ doc - > {configuration} - > {'country-list'} - > {country}}、$ platform_name; - 提案されたが、私は確信していない、どのように正確に私は新しい国を追加するためにプッシュを使用する必要があります。 – hari