paulami_perl has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, Updated version of my post... Sorry for the previpous inconvenient post..:) I wanted to add some more attributes in an existing xml using perl script. ex..
<Codeline codeline-name="NW702_COR"> <Patch-attributes CR-Number="012006153200021828702013" SCV-name= +"PROCESS ENGINE 7.02" SP-Level="11" patch-level="12" DO-name="UWLJWF1 +1P" Changelist="159103" /> </Codeline>
like after changelist attribute i want to add two more attributes like packaging_project_name="P1" environment_project_name="EV1" and finally my xml should look like
<Codeline codeline-name="NW702_COR"> <Patch-attributes CR-Number="012006153200021828702013" SCV-name= +"PROCESS ENGINE 7.02" SP-Level="11" patch-level="12" DO-name="UWLJWF1 +1P" Changelist="159103" packaging_project_name="P1" environment_proje +ct_name="EV1" /> </Codeline>
could you suggest me some ways to handle this?? Thanks. paul

Replies are listed 'Best First'.
Re: editing xml using perl
by GrandFather (Saint) on Nov 05, 2013 at 08:15 UTC

    I couldn't be bothered to read your node because you couldn't be bothered to read the formatting advice so in answer to your title: use XML::Twig.

    True laziness is hard work
Re: editing xml using perl (search add xml attribute)
by Anonymous Monk on Nov 05, 2013 at 10:11 UTC
Re: editing xml using perl
by marinersk (Priest) on Nov 05, 2013 at 17:38 UTC
    I see you tried to format correctly but missed the slash on the closing </code> tag.

    You do realize that you are supposed to preview your post before creating it, right? If it doesn't look right in the top section of the creation page, change it and Preview again. Repeat until it looks right.

    Don't just dump the garbage here for later cleanup. If you didn't understand the preview page, now you can learn. If you do understand the preview page and drop this garbage on the site anyway, that's rude.

      please, one person commenting on editing etiquette is enough :)
        Perhaps, but I thought partial credit for the effort (even though it failed) was in order. That had not been acknowledged in the first ettiquettesque post.  :-)