PDA

View Full Version : replacing sections in XML


VBuild_Rookie
05-07-2004, 12:18 PM
I want to be able to replace sections of the XML file using visual build. Is this possible I have no clue on how to do this but I just need to change sections of config files (.NET) for diff enviroments

<appSettings>
<add key="DatasourceConnection" value="blah lah" />
<add key="ServerlessLDAPBinding" value="blah" />
<add key="ActiveDirectoryServer" alue="blah"/>
<add key="NewtonUsersOU" value="blah"/>
<add key="NewtonUsersOUContainer" value="blah"/>
</appSettings>

WITH
<appSettings>
<add key="DatasourceConnection" value="NEW blah lah" />
<add key="ServerlessLDAPBinding" value="NEW blah" />
<add key="ActiveDirectoryServer" alue="NEW blah"/>
<add key="NewtonUsersOU" value="NEW blah"/>
<add key="NewtonUsersOUContainer" value="NEW blah"/>
</appSettings>

kinook
05-07-2004, 02:35 PM
The attached sample uses MSXML to do this.

jcox
06-21-2004, 01:00 PM
Can we parse the values out into Temp Macros?

kinook
06-21-2004, 06:10 PM
This sample demonstrates writing to an XML file, not reading. If you want to provide values to be written from temporary macros, just replace the strings with macro references, for instance:

UpdateAttribute msxml, "DatasourceConnection", "%MY_MACRO_NAME%"

As far as parsing values out of an XML file into temporary macros, this sample demonstrates that: http://www.kinook.com/Forum/showthread.php?threadid=237