http://qs1969.pair.com?node_id=11133117


in reply to Re^2: XML::Simple and ISO-8859-1 encoding buggy?
in thread XML::Simple and ISO-8859-1 encoding buggy?

> Basically the equivalent of simplicity to parsing a JSON file.

The problem is the DOM tree of XML doesn't correspond 1:1 to common data structures (scalars, arrays, hashes).

<r ch="1"> <ch>2</ch> <ch>3</ch> <!-- <ch>4</ch> --> </r>
What data structure do you expect?

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^4: XML::Simple and ISO-8859-1 encoding buggy?
by cavac (Parson) on May 27, 2021 at 11:41 UTC

    I expect that all of the "ch" elements in this tag will be put into an array. But what i really expect is that the XML doesn't come with such a stupid and confusing design in the first place. I can't see a semantic reason for this type of XML design. If someone sends me a design like this and does not have a very, very, very good explanation and a very solid reason behind this, i will just refuse to accept that design.

    Just because something is possible does not mean it is acceptable. Like using obfuscation in production code.

    perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'