BLU Discuss list archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss] perl and xml
- Subject: [Discuss] perl and xml
- From: richb at pioneer.ci.net (Rich Braun)
- Date: Tue, 10 Oct 2017 10:31:24 -0700
- In-reply-to: <mailman.5.1507651204.11387.discuss@blu.org>
- References: <mailman.5.1507651204.11387.discuss@blu.org>
"R. Luoma" <nobluspam5476 at penguinmail.com> wrote: > 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 > ... [ xml stuff] ... > I want to change tagA contents so that > they contain the quoted text in tagB as follows Here's how I'd do the same thing in python: #!/usr/bin/env python import xml.etree.ElementTree as tree obj = tree.parse('things.xml') root = obj.getroot() root[0][0].text = 'good_tag_001' obj.write('newthings.xml') Bill Ricker noted: > In Perl's spirit of TIMTOWTDI, There is More than One Way to Do It. Indeed, so does python. But it's really easy to learn this particular way of parsing XML, and python is part of the base Linux distro in most environments. Learn more at: https://docs.python.org/2/library/xml.etree.elementtree.html -rich
- Follow-Ups:
- [Discuss] perl and xml
- From: bill.n1vux at gmail.com (Bill Ricker)
- [Discuss] perl and xml
- Prev by Date: [Discuss] Treasurer's report
- Next by Date: [Discuss] Treasurer's report
- Previous by thread: [Discuss] [Boston.pm] perl and xml
- Next by thread: [Discuss] perl and xml
- Index(es):