Search and replace text in XML file?

Tim Roberts timr at probo.com
Sun Jul 29 00:32:31 CEST 2012


todd.tabern at gmail.com wrote:
>
>I basically need to replace every occurrence C:\Program Files with
>C:\Program Files (x86), regardless of location. For example, that 
>text appears within: 
><URL>C:\Program Files\\Map Data\Road_Centerlines.shp</URL>
>and also within: 
><RoutingIndexPathName>C:\Program Files\Templates\RoadNetwork.rtx</RoutingIndexPathName>
>...among others.
>I've tried some non-python methods and they all ruined the XML structure. 

I don't see how that's possible.  XML doesn't have any character counts,
and it doesn't care about extra white space.  A rock-stupid editor
substitution should have been able to do this in two seconds.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list