The wrong thing is that if the tag is repeated, you end up with an array reference, if it's not, you end up with a string (if it contains just content and no attributes or child tags) or hash reference (if it does have attributes or children). Do see Simpler than XML::Simple.
The code in the root node would throw a "Not a hash reference" exception if there are more <descript> tags in one desc, the node in your other node would throw "Not an array reference" if there is just one.
You are trying to use the ForceArray option, but you failed to include "descript" in the list. That would force XML::Simple to always produce an array reference so that the second code works.
Jenda
Enoch was right!
Enjoy the last years of Rome.
In reply to Re^3: XML parsing
by Jenda
in thread XML parsing
by asa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |