【问题标题】:The xml attribute "id" seems to be a protected attribute. What config needed to be able to set it?xml 属性“id”似乎是受保护的属性。需要什么配置才能设置它?
【发布时间】:2013-02-12 12:15:07
【问题描述】:

我正在使用 perl 模块 XML::Simple 创建 XML 结构。 一切正常,除了字符串"<tag1 id="5"> ABC </tag1>" 之后看起来像<tag1 name="5"> ABC </tag1>

我使用XML::Simple的字符串如下

my $simple = XML::Simple->new();
my $tree = $simple->XMLin($my_xml_string, ForceArray => 1);

$resp->data()->{'xml'} = $tree;

xml 属性id 似乎是一个受保护的属性,因为我在输出中得到了name

需要什么配置才能设置它?

【问题讨论】:

    标签: perl xml-simple


    【解决方案1】:

    查看KeyAttr 选项。您可能希望 KeyAttr => [] 停用数组以进行散列折叠

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-12
      • 1970-01-01
      • 2019-10-17
      • 1970-01-01
      • 2013-08-29
      • 1970-01-01
      • 2011-03-09
      • 2011-03-11
      相关资源
      最近更新 更多