Click here to Skip to main content
14,742,016 members
Home » Discussions » XML / XSL
   

XML / XSL

 
AnswerRe: How limitate the attribute of the root to it? Pin
dasblinkenlight9-Mar-11 3:20
Memberdasblinkenlight9-Mar-11 3:20 
QuestionIs Serialization worth it? Pin
Ger Hayden22-Feb-11 0:47
MemberGer Hayden22-Feb-11 0:47 
Questiongenerate xml based on schema. Pin
Ramkumar_S16-Feb-11 16:33
MemberRamkumar_S16-Feb-11 16:33 
AnswerRe: generate xml based on schema. Pin
Ger Hayden22-Feb-11 1:04
MemberGer Hayden22-Feb-11 1:04 
QuestionCustomizing RSS Feed - XSL to display rss your way. Pin
Sparx200914-Feb-11 3:36
MemberSparx200914-Feb-11 3:36 
AnswerRe: Customizing RSS Feed - XSL to display rss your way. Pin
Ravi Sant16-Feb-11 5:09
MemberRavi Sant16-Feb-11 5:09 
QuestionConverting some RTF text to WordML Pin
Ravi Sant8-Feb-11 20:55
MemberRavi Sant8-Feb-11 20:55 
QuestionHelp editing Xml file in C# Pin
jadughar3-Feb-11 22:32
Memberjadughar3-Feb-11 22: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 23:03
professional Xmen Real 3-Feb-11 23:03 
GeneralRe: Help editing Xml file in C# Pin
jadughar3-Feb-11 23:38
Memberjadughar3-Feb-11 23:38 
GeneralRe: Help editing Xml file in C# Pin
Xmen Real 3-Feb-11 23:41
professional Xmen Real 3-Feb-11 23:41 
GeneralRe: Help editing Xml file in C# Pin
jadughar3-Feb-11 23:57
Memberjadughar3-Feb-11 23:57 
QuestionBehavior of '+' operator for String in XSL Pin
itsaswath29-Jan-11 7:48
Memberitsaswath29-Jan-11 7:48 
QuestionSilverlight XSD and datatable Pin
Mycroft Holmes17-Jan-11 22:46
professionalMycroft Holmes17-Jan-11 22:46 
GeneralXSL Drop Down Pin
manowj24-Dec-10 22:46
Membermanowj24-Dec-10 22:46 
QuestionHow to deserialize this one Pin
igalep13219-Dec-10 20:12
Memberigalep13219-Dec-10 20:12 
QuestionSaving a word document(2000 to 2010) to xml Pin
Haim Nachum10-Dec-10 7:13
MemberHaim Nachum10-Dec-10 7:13 
GeneralRe: Saving a word document(2000 to 2010) to xml Pin
RaviRanjanKr10-Dec-10 8:46
professionalRaviRanjanKr10-Dec-10 8:46 
QuestionHow do I include PHP codes in an XML file? Pin
Jackaal2-Dec-10 12:54
MemberJackaal2-Dec-10 12:54 
AnswerRe: How do I include PHP codes in an XML file? Pin
Yvan Rodrigues13-Dec-10 15:35
professionalYvan Rodrigues13-Dec-10 15:35 
Questioncreate multiple XML files Pin
hmise30-Nov-10 3:29
Memberhmise30-Nov-10 3:29 
AnswerRe: create multiple XML files Pin
Pete O'Hanlon30-Nov-10 3:57
mvePete O'Hanlon30-Nov-10 3:57 
GeneralRe: create multiple XML files Pin
hmise30-Nov-10 4:20
Memberhmise30-Nov-10 4:20 
GeneralRe: create multiple XML files Pin
Pete O'Hanlon30-Nov-10 5:00
mvePete O'Hanlon30-Nov-10 5:00 
GeneralRe: create multiple XML files Pin
hmise1-Dec-10 3:12
Memberhmise1-Dec-10 3: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.