Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Sort xml nodes by schema

by AlexTape (Monk)
on Sep 10, 2013 at 10:12 UTC ( #1053222=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Sort xml nodes by schema
in thread Sort xml nodes by schema

can you give an example?

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


Comment on Re^3: Sort xml nodes by schema
Re^4: Sort xml nodes by schema
by laozi (Novice) on Sep 10, 2013 at 10:20 UTC

    This is the hash structure

    'image' => { 'linux_axp_lpae' => { # Mandatory image_name => 'uImage-axp-lpae', code_ref => 'linux_3.2.40_13q3_uni', linux_image => { compiler => 'v7_le_sfp_latest', defconfig => 'armada_xp_v7smp_defconfig', modules => '1', config => { 'CONFIG_ARM_LPAE' => {value => 'y'}, 'CONFIG_SQUASHFS' => {value => 'y'} }, }, 'post_script' => ['cesa/openswan/ipsec_build.sh'] }, }
    and this is the xml i get
    <image image_name="uImage-axp-lpae" code_ref="linux_3.2.40_13q3_uni"> <linux_image compiler="v7_le_sfp_latest" defconfig="armada_xp_v7smp_defconfig" modules="1"> <config image="CONFIG_ARM_LPAE" value="y" /> <config image="CONFIG_SQUASHFS" value="y" /> </linux_image> <post_script>cesa/openswan/ipsec_build.sh</post_script> </image>
    as you can see "code_ref" becomes a attribute but i need it to be an element
      just an idea:
      code_ref => 'linux_3.2.40_13q3_uni' should look like -> code_ref => ['linux_3.2.40_13q3_uni']

      for that you have to do something like this:
      ${${$hash{'image'}}{'linux_axp_lpae'}}{'code_ref'}=@{'linux_3.2.40_13q_uni'};

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

        it does the job

        i searched a bit and i am surprised there is no option for XMLout that does this

        Thanks again

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053222]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (16)
As of 2015-07-06 17:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (78 votes), past polls