Subject: | XML parsing error on numerically keyed lists |
Where the result from make_request contains a numerically keyed list, as
is the case when using the "get" action on a "domain" object with a type
that returns a list of name servers, an XML parsing error occurs. This
is on the second call to XMLin when "de-nastying" the returned data.
The problem is that XML::Simple folds away the "item" key when it is
first called and then folds away the "key" key.
Nameserver lists are all keyed numerically so the transformation is from:
<item key="nameserver_list">
<dt_array>
<item key="0">
<dt_assoc>
<item key="name">ns0.domain.tld</item>
<item key="sortorder">1</item>
<item key="ipaddress"></item>
</dt_assoc>
</item>
<item key="1">
<dt_assoc>
<item key="name">ns1.domain.tld</item>
<item key="sortorder">2</item>
<item key="ipaddress"></item>
</dt_assoc>
</item>
</dt_array>
</item>
to:
<item name="nameserver_list">
<dt_array name="item">
<0 name="dt_assoc">
<item name="ipaddress" />
<item name="name">ns0.ukpost.com</item>
<item name="sortorder">1</item>
</0>
<1 name="dt_assoc">
<item name="ipaddress" />
<item name="name">ns1.ukpost.com</item>
<item name="sortorder">2</item>
</1>
</dt_array>
</item>
which fails on the final call to XMLin as it is not valid to have an XML
element with a numeric name or a name that starts with a number.