Adnan

Adnan

  • NA
  • 1
  • 0

xmlreader read file and write after root node

Oct 9 2009 7:12 AM
Hello,
first i am creating xml file if file does not exist.
String myFile = "C:\myxmlfile.xml";
if (!File.Exists(myFile)) {
using (FileStream conStream = new FileStream(myFile, FileMode.Create, FileAccess.Write)) {
XmlWriter conWriter = new XmlTextWriter(conStream, Encoding.UTF8);
conWriter.WriteStartDocument();
conWriter.WriteStartElement("myrootnode");
conWriter.WriteStartElement("myfirstnode");
conWriter.WriteEndDocument();
conWriter.Close();
conStream.Close();
}
else
{
here read file which i just created in above code and write after new entries after root node, How to implement it or How to search for rootnode and attach new entries after root node?
Any help would be highly appreciated.
Thanks
}
Best Regards
Adnan

Answers (1)