473,395 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

inserting a text into xml file

Hi friends, I am new to csharp and XML :

fp=File.OpenText(server.mappath(".\\upload\\")+"te st.txt");
string info=fp.readtoend();
string[] arinfo =new string[4];

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]);

What i am doing here is ,I am creating a new XML file Each TIME.

I dnt want like this , I have to insert into already created XML File ,In
that file i specified Each Element ,I want to insert values into inthat
element ,Without specifying (i.e username) each elements

anyone help me to solve this problem

Thanx and Regards
Selva.R
..............
Jul 24 '06 #1
2 4942
Load XML into XmlDocument.
Modify some elements of XmlDocument.
Same it back to file.

Sergey

"C# to XML" <Ct****@discussions.microsoft.comwrote in message
news:9F**********************************@microsof t.com...
Hi friends, I am new to csharp and XML :

fp=File.OpenText(server.mappath(".\\upload\\")+"te st.txt");
string info=fp.readtoend();
string[] arinfo =new string[4];

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]);

What i am doing here is ,I am creating a new XML file Each TIME.

I dnt want like this , I have to insert into already created XML File ,In
that file i specified Each Element ,I want to insert values into inthat
element ,Without specifying (i.e username) each elements

anyone help me to solve this problem

Thanx and Regards
Selva.R
.............

Jul 24 '06 #2


"Sergey Dubinets" wrote:
Load XML into XmlDocument.
Modify some elements of XmlDocument.
Same it back to file.

Sergey

"C# to XML" <Ct****@discussions.microsoft.comwrote in message
news:9F**********************************@microsof t.com...
Hi friends, I am new to csharp and XML :

fp=File.OpenText(server.mappath(".\\upload\\")+"te st.txt");
string info=fp.readtoend();
string[] arinfo =new string[4];

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]);

What i am doing here is ,I am creating a new XML file Each TIME.

I dnt want like this , I have to insert into already created XML File ,In
that file i specified Each Element ,I want to insert values into inthat
element ,Without specifying (i.e username) each elements

anyone help me to solve this problem

Thanx and Regards
Selva.R
.............

i DNT UNDERSTAND CANU EXPLAIN BRIEFLY
Hi Morten ,
Reading file is mot a problem for me,

I have to insert into xml file,these each text which i read from text file

I dnt want to use new XML file , I have to insert into existing xml file
segments

Can u briefly explain me how to do..

THanx and regards
SELVA.R
>
Jul 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ajk | last post by:
. Hi, All: I know how to insert files into a Word doc using C#. However, the program I've written to do this runs much too slowly. The "myObj".Application.Selection.InsertFile method executes...
4
by: AHP | last post by:
Hi, I'm using Visual Studio 2005. I am developing a web application that uses the FileUpload control to upload text files to a directory on a webserver. This works fine. However, for me to be...
0
by: RosH | last post by:
Dear All, Please find below an Inserting Event code expected to trigger just before the insert event of a FormView control. Everything works just fine but the event throws an exception that the...
0
by: RosH | last post by:
Dear All, Please find below an Inserting Event code expected to trigger just before the insert event of a FormView control. Everything works just fine but the event throws an exception that the...
1
Ajm113
by: Ajm113 | last post by:
Ok, when I was new to this I had this problem and I bet a lot of other people did when they where new to PHP and Mysql. So this mite be your question; "Ok, no errors or warnings in mysql and php so...
1
by: hanusoft | last post by:
This is an example of Inserting and Retrieving data from xml file. private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here ...
1
by: hanusoft | last post by:
This is an example of Inserting and Retrieving data from xml file. private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here ...
0
by: toyin | last post by:
hello, pls help look through this code its not inserting the record in dataset into the another database. i want to insert the row in the dataset into another table in another database. pls help....
5
by: pramodkh | last post by:
Hi All I am trying to match a pattern in a file and insert a line. If the pattern matches then insert a line before the matching pattern line. for example, I have the following content in a...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.