Re: XML - Find and replace text
- From: gcgaim@xxxxxxxxx
- Date: Wed, 19 Sep 2007 15:45:29 -0000
On Sep 19, 10:52 am, schl...@xxxxxxxxxxxxxxxx wrote:
gcg...@xxxxxxxxx wrote:
On Sep 19, 10:48 am, gcg...@xxxxxxxxx wrote:
What would be the cleanest way to parse an XML file and replace
certain pieces of text that match a specified pattern? I'm going to
know the exact "location" as in the text is always going to be at:
<a>
<b>
<c=stuff>text to replace here</c></b></a>
Any help is appreciated!
I'm using ActiveTcl if that makes any difference.
Cleanest is probably using XSLT with the tdom package.
Michael
OK, so assuming the XML structure is:
<install>
<service>
...
</service>
<service>
<url>
<data name="config1>this is what I want to change</data>
</url>
</service>
</install>
How do I set the value in <data name=config1>. This is what I have so
far.
package require tdom
set fp [open "config.xml" r]
set xml [read $fp]
set doc [dom parse $xml]
set root [$doc documentElement]
Thank you again!
.
- Follow-Ups:
- Re: XML - Find and replace text
- From: Georgios Petasis
- Re: XML - Find and replace text
- From: Ramon Ribó
- Re: XML - Find and replace text
- References:
- XML - Find and replace text
- From: gcgaim
- Re: XML - Find and replace text
- From: gcgaim
- Re: XML - Find and replace text
- From: schlenk
- XML - Find and replace text
- Prev by Date: Re: how can i read the last line of a file using tcl console commands???
- Next by Date: Re: how can i read the last line of a file using tcl console commands???
- Previous by thread: Re: XML - Find and replace text
- Next by thread: Re: XML - Find and replace text
- Index(es):
Relevant Pages
|