http://qs321.pair.com?node_id=1053207


in reply to Sort xml nodes by schema


XML::Simple on CPAN

to supress XMLout generating empty hash entry use 'SuppressEmpty'

SuppressEmpty => 1 | '' | undef # in+out - handy

This option controls what XMLin() should do with empty elements (no attributes and no content). The default behaviour is to represent them as empty hashes. Setting this option to a true value (eg: 1) will cause empty elements to be skipped altogether. Setting the option to 'undef' or the empty string will cause empty elements to be represented as the undefined value or the empty string respectively. The latter two alternatives are a little easier to test for in your code than a hash with no keys.

The option also controls what XMLout() does with undefined values. Setting the option to undef causes undefined values to be output as empty elements (rather than empty attributes), it also suppresses the generation of warnings about undefined values. Setting the option to a true value (eg: 1) causes undefined values to be skipped altogether on output.

sorting: maybe you can presort your data in an array before invoking XMLout() with it?

mabye this can help:
XML Schema: order of elements
XML Schema: Allow any order

$perlig =~ s/pec/cep/g if 'errors expected';