Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month, online, via Jitsi Meet.

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] perl and xml



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



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org