Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26157

Re: Search and replace text in XML file?

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'preference': 0.05; 'subject:text': 0.05; 'subject:file': 0.07; 'definition,': 0.09; 'lawrence': 0.09; 'terry': 0.09; 'automation,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'lite': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'processor,': 0.16; 'reedy': 0.16; 'subject:XML': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'windows': 0.19; 'changes': 0.20; 'file.': 0.20; 'project,': 0.24; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'replace': 0.27; 'run': 0.28; 'received:192.168.1.3': 0.29; "i'm": 0.29; 'knows': 0.30; 'file': 0.32; 'structure': 0.32; 'suggestion': 0.32; 'bought': 0.33; 'text,': 0.33; 'anyone': 0.33; 'to:addr:python- list': 0.33; 'text': 0.34; 'or,': 0.34; 'basis.': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'editor': 0.37; 'xml': 0.37; 'maintaining': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'email addr:gmail.com': 0.63; 'request.': 0.64; 'liked': 0.66; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; 'processor.': 0.84; 'reply- to:addr:python.org': 0.84; 'subject:Search': 0.84
X-CM-Score 0.00
X-CNFS-Analysis v=2.0 cv=aJVyWMBm c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=DKcI9XZsuF4A:10 a=g05EXziHdPAA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=pGLkceISAAAA:8 a=DImoZL8pWxlYEgE2NGMA:9 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117
X-AUTH mrabarnett:2500
Date Sat, 28 Jul 2012 17:01:19 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Search and replace text in XML file?
References <5535f70f-4542-451f-8b08-a62b45d15c11@googlegroups.com> <jv03ni$b0q$1@dough.gmane.org> <jv07so$4n0$1@dough.gmane.org>
In-Reply-To <jv07so$4n0$1@dough.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To python-list@python.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2669.1343491287.4697.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343491287 news.xs4all.nl 6840 [2001:888:2000:d::a6]:46822
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26157

Show key headers only | View raw


On 28/07/2012 09:29, Mark Lawrence wrote:
> On 28/07/2012 08:17, Terry Reedy wrote:
>> On 7/27/2012 9:23 PM, todd.tabern@gmail.com wrote:
>>> I'm looking to search an entire XML file for specific text and
>>> replace that text, while maintaining the structure of the XML file.
>>
>> For a one-off project, or for experimentation, I would use a proper
>> text-editor* and run through with search/replace. For automation, use
>> Jason's suggestion of .replace, perhaps on a line-by-line basis.
>>
>> * By definition, such only make changes you request. Notepad++ is one
>> such on Windows. You do not want a word or document processor, or, for
>> simple xml oblivious text substitutions, an xml processor. Such things
>> often make changes of various sorts.
>>
>
> I highly recommend the use of notepad++.  If anyone knows of a better
> text editor for Windows please let me know :)
>
My own preference is EditPad. I liked EditPad Lite so much that I
bought EditPad Pro.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Search and replace text in XML file? todd.tabern@gmail.com - 2012-07-27 18:23 -0700
  Re: Search and replace text in XML file? Jason Friedman <jason@powerpull.net> - 2012-07-27 20:07 -0600
  Re: Search and replace text in XML file? Terry Reedy <tjreedy@udel.edu> - 2012-07-28 03:17 -0400
    Re: Search and replace text in XML file? Paul Rudin <paul.nospam@rudin.co.uk> - 2012-07-31 15:45 +0100
  Re: Search and replace text in XML file? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-07-28 09:29 +0100
  Re: Search and replace text in XML file? MRAB <python@mrabarnett.plus.com> - 2012-07-28 17:01 +0100
  Re: Search and replace text in XML file? Tim Roberts <timr@probo.com> - 2012-07-28 15:32 -0700

csiph-web