Print Page | Close Window

XML File replace string

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=482
Printed Date: 28 March 2026 at 1:52pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: XML File replace string
Posted By: michael
Subject: XML File replace string
Date Posted: 24 February 2003 at 1:46pm

I have an xml file withe a part looking like this:
<TransformationRules>
   <BIGateway>
    <SourceValue>http://doorknob/cgi-bin/ppdscgi.exe
</SourceValue>
    <TargetValue>http://grapeape/cgi-bin/ppdscgi.exe
</TargetValue>
   </BIGateway>
  </TransformationRules>

I need to find a way to replace the SourceValue with the TargetValue and replace the TargetValue's server name (in this case grapeape) with the computername the script is ran on. Does anyone have some experience with XML on how to accomplish that. I can figure the part on how to write it once is done myself, just not sure how to do the search / replace.

Thanks



-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Replies:
Posted By: MorningZ
Date Posted: 24 February 2003 at 2:05pm
you'll have to use XSL to transform that document into another XML doc

thats one way anyways...

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: nittystone
Date Posted: 24 February 2003 at 8:55pm

set objdom=server.createobject("microsoft.xmldom")

objdom.load(yourxmlfilepath)

xPath="//TransformationRules/SourceValue"

objdom.selectsingleNode(xPath).text=yournewvalue

objdom.save(yourxmlfilepath)

 



-------------
i'm fly to be near you to be free

i'm a chinese
i want study english in here
thanks every obdy


Posted By: michael
Date Posted: 25 February 2003 at 10:56am
thanks nittystone, i think i can start with that....



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net