A
armaan12345
Guest
I AM USING THIS CODE TO MAKE A FILE
XmlWriterSettings mysetting = new XmlWriterSettings();
mysetting.Indent = true;
mysetting.IndentChars = "\t";
mysetting.NewLineChars = "\r\n";
XmlWriter xw = XmlWriter.Create(@"D:/a.xml", mysetting);
xw.WriteStartElement("parent");
xw.WriteStartElement("child");
xw.WriteAttributeString("Name", textBox1.Text);
xw.WriteAttributeString("address", textBox2.Text);
xw.WriteAttributeString("phone", textBox4.Text);
xw.WriteEndElement();
xw.WriteEndElement();
AND OUTPUT IS
<?xml version="1.0" encoding="utf-8"?>
<parent>
<child Name="MYNAME" address="MYADDRESS" phone="MYPHONENUMBER" />
</parent>
NOW I WANT TO ADD MORE DATA WITHOUT LOSE OLD DATA OUTPUT LIKE THIS
<?xml version="1.0" encoding="utf-8"?>
<parent>
<child Name="MYNAME" address="MYADDRESS" phone="MYPHONENUMBER" />
<child Name="MYNAME2" address="MYADDRESS2" phone="MYPHONENUMBER2" />
<child Name="MYNAME3" address="MYADDRESS3" phone="MYPHONENUMBER3" />
<child Name="MYNAME4" address="MYADDRESS4" phone="MYPHONENUMBER4" />
</parent>
HOW???? PLESE HELP
Continue reading...
XmlWriterSettings mysetting = new XmlWriterSettings();
mysetting.Indent = true;
mysetting.IndentChars = "\t";
mysetting.NewLineChars = "\r\n";
XmlWriter xw = XmlWriter.Create(@"D:/a.xml", mysetting);
xw.WriteStartElement("parent");
xw.WriteStartElement("child");
xw.WriteAttributeString("Name", textBox1.Text);
xw.WriteAttributeString("address", textBox2.Text);
xw.WriteAttributeString("phone", textBox4.Text);
xw.WriteEndElement();
xw.WriteEndElement();
AND OUTPUT IS
<?xml version="1.0" encoding="utf-8"?>
<parent>
<child Name="MYNAME" address="MYADDRESS" phone="MYPHONENUMBER" />
</parent>
NOW I WANT TO ADD MORE DATA WITHOUT LOSE OLD DATA OUTPUT LIKE THIS
<?xml version="1.0" encoding="utf-8"?>
<parent>
<child Name="MYNAME" address="MYADDRESS" phone="MYPHONENUMBER" />
<child Name="MYNAME2" address="MYADDRESS2" phone="MYPHONENUMBER2" />
<child Name="MYNAME3" address="MYADDRESS3" phone="MYPHONENUMBER3" />
<child Name="MYNAME4" address="MYADDRESS4" phone="MYPHONENUMBER4" />
</parent>
HOW???? PLESE HELP
Continue reading...