G
Guest
Hi Friends,
I am new to csharp , I am using the following code to write into xml file :
Just go through the code :
fp = File.OpenText(Server.MapPath(".\\upload\\") + "test.txt");
string info = fp.ReadToEnd();
string[] arInfo = new string[4];
// define which character is seperating fields
char[] splitter = {'|','^'};
arInfo = info.Split(splitter);
for(int x = 0; x < arInfo.Length; x++)
{
Response.Write(arInfo[x] + "<br>");
a = arInfo[x];
XmlTextWriter xwriter = new XmlTextWriter("C:/xml/data.xml",
System.Text.Encoding.UTF8);
xwriter.WriteStartDocument(true);
xwriter.WriteStartElement("LogIn");
xwriter.WriteElementString("username", arInfo[0]);
xwriter.WriteElementString("password",arInfo[1]);
xwriter.WriteElementString("third", arInfo[2]);
xwriter.WriteEndElement();
xwriter.WriteEndDocument();
xwriter.Close();
Label3.Text = "File Succesfully Read!";
}
Here I am creating new XML file and Elements to insert a values:
What i need is I have specify the location of particular XML file (this XML
File i have created manually ,i have created elements in this schemas)
I have to insert each values into xml file element,(i.e without specifying
each element )
Thanx and Regards
I am new to csharp , I am using the following code to write into xml file :
Just go through the code :
fp = File.OpenText(Server.MapPath(".\\upload\\") + "test.txt");
string info = fp.ReadToEnd();
string[] arInfo = new string[4];
// define which character is seperating fields
char[] splitter = {'|','^'};
arInfo = info.Split(splitter);
for(int x = 0; x < arInfo.Length; x++)
{
Response.Write(arInfo[x] + "<br>");
a = arInfo[x];
XmlTextWriter xwriter = new XmlTextWriter("C:/xml/data.xml",
System.Text.Encoding.UTF8);
xwriter.WriteStartDocument(true);
xwriter.WriteStartElement("LogIn");
xwriter.WriteElementString("username", arInfo[0]);
xwriter.WriteElementString("password",arInfo[1]);
xwriter.WriteElementString("third", arInfo[2]);
xwriter.WriteEndElement();
xwriter.WriteEndDocument();
xwriter.Close();
Label3.Text = "File Succesfully Read!";
}
Here I am creating new XML file and Elements to insert a values:
What i need is I have specify the location of particular XML file (this XML
File i have created manually ,i have created elements in this schemas)
I have to insert each values into xml file element,(i.e without specifying
each element )
Thanx and Regards