Click here to Skip to main content
14,549,334 members
   

XML / XSL

 
AnswerRe: How limitate the attribute of the root to it? Pin
dasblinkenlight9-Mar-11 2:20
Memberdasblinkenlight9-Mar-11 2:20 
QuestionIs Serialization worth it? Pin
Ger Hayden21-Feb-11 23:47
MemberGer Hayden21-Feb-11 23:47 
Questiongenerate xml based on schema. Pin
Ramkumar_S16-Feb-11 15:33
MemberRamkumar_S16-Feb-11 15:33 
AnswerRe: generate xml based on schema. Pin
Ger Hayden22-Feb-11 0:04
MemberGer Hayden22-Feb-11 0:04 
QuestionCustomizing RSS Feed - XSL to display rss your way. Pin
Sparx200914-Feb-11 2:36
MemberSparx200914-Feb-11 2:36 
AnswerRe: Customizing RSS Feed - XSL to display rss your way. Pin
Ravi Sant16-Feb-11 4:09
MemberRavi Sant16-Feb-11 4:09 
QuestionConverting some RTF text to WordML Pin
Ravi Sant8-Feb-11 19:55
MemberRavi Sant8-Feb-11 19:55 
QuestionHelp editing Xml file in C# Pin
jadughar3-Feb-11 21:32
Memberjadughar3-Feb-11 21:32 
Hi
I'm trying to modify an Xml file. This is the content of the Xml. The problem is that after changes, it will creates a copy of the content of the Xml file without changing the old content.

Before changes :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="Application.Properties.Settings.DBConnectionString"
      connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DB.mdb"
      providerName="System.Data.OleDb" />
  </connectionStrings>
</configuration>


After changes :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="Application.Properties.Settings.DBConnectionString"
      connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DB.mdb"
      providerName="System.Data.OleDb" />
  </connectionStrings>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="Application.Properties.Settings.DBConnectionString"
      connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DataBase\DB.mdb"
      providerName="System.Data.OleDb" />
  </connectionStrings>
</configuration>



The code is :
//xml document object
System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();

FileStream reader = new FileStream(this._XmlFilePath, FileMode.Open, FileAccess.ReadWrite);

xdoc.XmlResolver = null;

//load the xml file
xdoc.Load(reader);

System.Xml.XmlElement Node = (System.Xml.XmlElement)xdoc.DocumentElement.SelectSingleNode("//configuration/connectionStrings/add[@name=\"Application.Properties.Settings.DBConnectionString\"]");
if (Node != null)
{
    //key found, set the value
    Node.Attributes.GetNamedItem("Source").Value = "C:\DataDabe\DB.mdb";

    //finally, save the new version of the config file
    xdoc.Save(reader);
    reader.Close();
}

"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras

AnswerRe: Help editing Xml file in C# Pin
Xmen Real 3-Feb-11 22:03
professional Xmen Real 3-Feb-11 22:03 
GeneralRe: Help editing Xml file in C# Pin
jadughar3-Feb-11 22:38
Memberjadughar3-Feb-11 22:38 
GeneralRe: Help editing Xml file in C# Pin
Xmen Real 3-Feb-11 22:41
professional Xmen Real 3-Feb-11 22:41 
GeneralRe: Help editing Xml file in C# Pin
jadughar3-Feb-11 22:57
Memberjadughar3-Feb-11 22:57 
QuestionBehavior of '+' operator for String in XSL Pin
itsaswath29-Jan-11 6:48
Memberitsaswath29-Jan-11 6:48 
QuestionSilverlight XSD and datatable Pin
Mycroft Holmes17-Jan-11 21:46
professionalMycroft Holmes17-Jan-11 21:46 
GeneralXSL Drop Down Pin
manowj24-Dec-10 21:46
Membermanowj24-Dec-10 21:46 
QuestionHow to deserialize this one Pin
igalep13219-Dec-10 19:12
Memberigalep13219-Dec-10 19:12 
QuestionSaving a word document(2000 to 2010) to xml Pin
Haim Nachum10-Dec-10 6:13
MemberHaim Nachum10-Dec-10 6:13 
GeneralRe: Saving a word document(2000 to 2010) to xml Pin
RaviRanjanKr10-Dec-10 7:46
professionalRaviRanjanKr10-Dec-10 7:46 
QuestionHow do I include PHP codes in an XML file? Pin
Jackaal2-Dec-10 11:54
MemberJackaal2-Dec-10 11:54 
AnswerRe: How do I include PHP codes in an XML file? Pin
Yvan Rodrigues13-Dec-10 14:35
subeditorYvan Rodrigues13-Dec-10 14:35 
Questioncreate multiple XML files Pin
hmise30-Nov-10 2:29
Memberhmise30-Nov-10 2:29 
AnswerRe: create multiple XML files Pin
Pete O'Hanlon30-Nov-10 2:57
subeditorPete O'Hanlon30-Nov-10 2:57 
GeneralRe: create multiple XML files Pin
hmise30-Nov-10 3:20
Memberhmise30-Nov-10 3:20 
GeneralRe: create multiple XML files Pin
Pete O'Hanlon30-Nov-10 4:00
subeditorPete O'Hanlon30-Nov-10 4:00 
GeneralRe: create multiple XML files Pin
hmise1-Dec-10 2:12
Memberhmise1-Dec-10 2:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.