HighTechTalks DotNet Forums  

changing the xml file

Dotnet XML microsoft.public.dotnet.xml


Discuss changing the xml file in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Vinki
 
Posts: n/a

Default changing the xml file - 12-03-2007 , 10:26 PM






I have this xml file below, I want to change the value of debug to false.
How can I do this in C# or VB.net. if possible in this case I want use
SelectSingleNode




<?xml version="1.0"?>
<configuration>
<configSections>
<section name="dataConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Data.C onfiguration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data" />
</configSections>
<connectionStrings>

</connectionStrings>
<appSettings>
<add key="connectionString" value="sita" />

</appSettings>
<compilation debug="true">

</compilation>
<!--<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.OracleClient"
publicKeyToken="B77A5C561934E66" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>-->
</configuration>

Any help will be appreacitaed


Thanks.

Reply With Quote
  #2  
Old   
Martin Honnen
 
Posts: n/a

Default Re: changing the xml file - 12-04-2007 , 06:52 AM






Vinki wrote:
Quote:
I have this xml file below, I want to change the value of debug to false.
How can I do this in C# or VB.net. if possible in this case I want use
SelectSingleNode
XmlDocument doc = new XmlDocument();
doc.Load("file.xml");
XmlElement compilation =
doc.SelectSingleNode("configuration/compilation") as XmlElement;
if (compilation != null) {
compilation.SetAttribute("debug", "false");
doc.Save("file.xml");
}



--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.