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


Groups > comp.lang.python > #26155

Re: Search and replace text in XML file?

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Search and replace text in XML file?
Date 2012-07-28 09:29 +0100
References <5535f70f-4542-451f-8b08-a62b45d15c11@googlegroups.com> <jv03ni$b0q$1@dough.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.2667.1343464174.4697.python-list@python.org> (permalink)

Show all headers | View raw


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 :)

-- 
Cheers.

Mark Lawrence.

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