Click here to Skip to main content
16,006,845 members
Home / Discussions / C#
   

C#

 
Generaladd Xml in C# Pin
bertcox16-Mar-04 2:37
bertcox16-Mar-04 2:37 
GeneralRe: add Xml in C# Pin
rull16-Mar-04 3:34
rull16-Mar-04 3:34 
GeneralRe: add Xml in C# Pin
Philip Fitzsimons16-Mar-04 3:38
Philip Fitzsimons16-Mar-04 3:38 
GeneralRe: add Xml in C# Pin
bertcox16-Mar-04 4:28
bertcox16-Mar-04 4:28 
GeneralRe: add Xml in C# Pin
Philip Fitzsimons16-Mar-04 4:30
Philip Fitzsimons16-Mar-04 4:30 
GeneralRe: add Xml in C# Pin
bertcox16-Mar-04 4:43
bertcox16-Mar-04 4:43 
GeneralRe: add Xml in C# Pin
Philip Fitzsimons16-Mar-04 4:49
Philip Fitzsimons16-Mar-04 4:49 
GeneralRe: add Xml in C# Pin
bertcox16-Mar-04 4:59
bertcox16-Mar-04 4:59 
string filename = @"c:\country.xml";<br />
XmlDocument countryDocument = new XmlDocument();<br />
<br />
countryDocument.Load(filename);<br />
<br />
XmlNode parisNode = countryDocument.SelectSingleNode("/Country/City[@Name = 'Paris']"); <br />
<br />
XmlNode newStreetNode = countryDocument.CreateNode(XmlNodeType.Element,"Street",null);<br />
XmlAttribute newStreetNameAttr = countryDocument.CreateAttribute("Name");<br />
<br />
newStreetNameAttr.Value = "my new street";<br />
newStreetNode.Attributes.Append(newStreetNameAttr);<br />
<br />
XmlNode newStreetNameNode = countryDocument.CreateNode(XmlNodeType.Element,"Name",null);<br />
newStreetNameNode.InnerText = " Test 4 ";<br />
newStreetNode.AppendChild(newStreetNameNode);<br />
<br />
XmlNode newStreetAgeNode = countryDocument.CreateNode(XmlNodeType.Element,"Age",null);<br />
newStreetAgeNode.InnerText = " 42 ";<br />
newStreetNode.AppendChild(newStreetAgeNode);<br />
<br />
parisNode.AppendChild(newStreetNode);<br />
countryDocument.Save(filename); <br />



countryDocument.CreateNode(XmlNodeType.Element,"Name",null);
I found this in the MSDN because there was a mistake there to but did i fill it wrong?
GeneralRe: add Xml in C# Pin
Philip Fitzsimons16-Mar-04 5:01
Philip Fitzsimons16-Mar-04 5:01 
GeneralRe: add Xml in C# Pin
bertcox16-Mar-04 5:07
bertcox16-Mar-04 5:07 
GeneralRe: add Xml in C# Pin
Philip Fitzsimons16-Mar-04 5:13
Philip Fitzsimons16-Mar-04 5:13 
GeneralRe: add Xml in C# Pin
bertcox16-Mar-04 5:18
bertcox16-Mar-04 5:18 
GeneralRe: add Xml in C# Pin
Philip Fitzsimons16-Mar-04 5:22
Philip Fitzsimons16-Mar-04 5:22 
GeneralRe: add Xml in C# Pin
bertcox16-Mar-04 5:27
bertcox16-Mar-04 5:27 
GeneralSorting DataGrid (Data is from DataSet from XML) Pin
jazzle16-Mar-04 2:32
jazzle16-Mar-04 2:32 
GeneralRe: Sorting DataGrid (Data is from DataSet from XML) Pin
Dave Kreskowiak16-Mar-04 2:45
mveDave Kreskowiak16-Mar-04 2:45 
GeneralRe: Sorting DataGrid (Data is from DataSet from XML) Pin
jazzle16-Mar-04 3:10
jazzle16-Mar-04 3:10 
GeneralRe: Sorting DataGrid (Data is from DataSet from XML) Pin
Heath Stewart16-Mar-04 4:00
protectorHeath Stewart16-Mar-04 4:00 
GeneralGetting a method defined in *.lib file Pin
Tristan Rhodes16-Mar-04 1:49
Tristan Rhodes16-Mar-04 1:49 
GeneralRe: Getting a method defined in *.lib file Pin
Dave Kreskowiak16-Mar-04 2:51
mveDave Kreskowiak16-Mar-04 2:51 
GeneralJumping off a cliff Pin
Tristan Rhodes16-Mar-04 3:14
Tristan Rhodes16-Mar-04 3:14 
GeneralRe: Jumping off a cliff Pin
Heath Stewart16-Mar-04 3:48
protectorHeath Stewart16-Mar-04 3:48 
GeneralRe: Jumping off a cliff Pin
Tristan Rhodes16-Mar-04 4:06
Tristan Rhodes16-Mar-04 4:06 
GeneralTreeview structure in datagrid Pin
Inpreet Singh16-Mar-04 0:38
Inpreet Singh16-Mar-04 0:38 
GeneralRe: Treeview structure in datagrid Pin
Heath Stewart16-Mar-04 3:43
protectorHeath Stewart16-Mar-04 3:43 

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.