[Discuss] perl and xml

R. Luoma nobluspam5476 at penguinmail.com
Mon Oct 9 13:49:41 EDT 2017


This may be off-topic, but I am trying to manipulate
what I think is an "xml" file with perl (on a linux system).
I am not familiar with the ins and outs of xml


Consider the following -

<things>
   <item>
      <tagA>bogus001
      </tagA>
      <tagB>
        TagA should actually be "good_tag_001"
      </tagB>
      <tagC> C stuff </tagC>
   </item>
   <item>
      <tagA>bogus002   </tagA>
      <tagB>

        Some extra stuff.
        TagA should actually be "good_tag_002" </tagB>
      <tagC> some tabC info </tagC>
   </item>
</things>


I want to change tagA contents so that
they contain the quoted text in tagB as follows
(note that I wish the contents of TagB and
and other tag items to remain unchanged) --

<things>
   <item>
      <tagA>good_tag_001</tagA>
      <tagB>
        TagA should actually be "good_tag_001"
      </tagB>
      <tagC> C stuff </tagC>
   </item>
   <item>
      <tagA>good_tag_002</tagA>
      <tagB>

        Some extra stuff.
        TagA should actually be "good_tag_002" </tagB>
      <tagC> some tabC info </tagC>
   </item>
</things>


Supposedly, perl has xml modules for this purpose,
but I am have difficulty figuring them out.
The above example is simple, but, ultimately,
I would be working on an xml file with many items
and each item would have many different tags.

Thanks,
-- 
R. Luoma



More information about the Discuss mailing list