我怎样才能把我的Perl数组到XML? [英] How can I turn my Perl array to XML?

查看:107
本文介绍了我怎样才能把我的Perl数组到XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能在Perl数组像这样

How can I take a Perl array like this

@categories = ( ["Technology", "Gadgets"], ["TV & Film"] );

和产生这个XML片段?

and generate this XML snippet?

<itunes:category text="Technology">
    <itunes:category text="Gadgets"/>
</itunes:category>
<itunes:category text="TV &amp; Film"/>

我可以改变的数组,如果有一个更简单的方法来得到相同的输出。

I can change the array if there's an easier way to get to the same output.

推荐答案

有关使用Perl生成XML的通用方法看看的 XML ::发电机或的 XML ::作家

For a general approach of generating XML with perl have a look at XML::Generator or XML::Writer.

这篇关于我怎样才能把我的Perl数组到XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆