tobias_hofer has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
I got this following problem:
I got a hash which I want to get into xml. My problem is that the content (keys) of the hash are ordered alphabetically. Thus the content comes into a different order to file. This is not a problem to xml itself but a problem for the tool-chain following my perl script, which expects things to be in a specific order
My hash is generated and looks in the end like this
Any help is highly welcome!
best regards!
Tobias
I got this following problem:
I got a hash which I want to get into xml. My problem is that the content (keys) of the hash are ordered alphabetically. Thus the content comes into a different order to file. This is not a problem to xml itself but a problem for the tool-chain following my perl script, which expects things to be in a specific order
My hash is generated and looks in the end like this
and it comes it this order to xmlmy $TGROUP = { COLS => 4, COLSPEC => [... Array of hashes...], TBODY => HASH(0x8b...), THEAD => HASH(0x8bc...) }
but the tool requires it in a different order:<TRGROUP... <COLS ... <COLSPEC .. <TBODY .... <THEAD ... >
Therefore it would be simplest to reorder the sequence of keys in the hash.. i.e. like that:<TRGROUP... <COLS ... <COLSPEC .. <THEAD .... <TBODY ... >
Is this somehow possible to do? I tried to create the hash once more in a different order but this does not work.my $TGROUP = { COLS => 4, COLSPEC => [... Array of hashes...], THEAD => HASH(0x8b...), TBODY => HASH(0x8bc...) }
Any help is highly welcome!
best regards!
Tobias
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: xml using XML::Simple reording of XML-Content
by hdb (Monsignor) on Jun 17, 2013 at 11:53 UTC | |
Re: xml using XML::Simple reording of XML-Content
by Anonymous Monk on Jun 17, 2013 at 11:53 UTC | |
Re: xml using XML::Simple reording of XML-Content
by poj (Abbot) on Jun 17, 2013 at 15:27 UTC | |
Re: xml using XML::Simple reording of XML-Content
by tobias_hofer (Friar) on Jun 17, 2013 at 13:20 UTC |
Back to
Seekers of Perl Wisdom