inserting a text into xml file

Hi friends, I am new to csharp and XML :

               fp=File.OpenText(server.mappath(".\\upload\\")+"test.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
..............
0
CtoXML (2)
7/24/2006 7:02:01 AM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
542 Views

Similar Articles

[PageSpeed] 10

Load XML into XmlDocument.
Modify some elements of XmlDocument.
Same it back to file.

Sergey

"C# to XML" <CtoXML@discussions.microsoft.com> wrote in message 
news:9FDCAFA2-294F-4965-B92E-D14119811FBC@microsoft.com...
> Hi friends, I am new to csharp and XML :
>
>               fp=File.OpenText(server.mappath(".\\upload\\")+"test.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
> ............. 


0
sdub1 (12)
7/24/2006 4:45:48 PM

"Sergey Dubinets" wrote:

> Load XML into XmlDocument.
> Modify some elements of XmlDocument.
> Same it back to file.
> 
> Sergey
> 
> "C# to XML" <CtoXML@discussions.microsoft.com> wrote in message 
> news:9FDCAFA2-294F-4965-B92E-D14119811FBC@microsoft.com...
> > Hi friends, I am new to csharp and XML :
> >
> >               fp=File.OpenText(server.mappath(".\\upload\\")+"test.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
> 
0
CtoXML (2)
7/25/2006 3:37:02 AM
Reply:

Similar Artilces:

How do I insert Roman Numerals?
New to Word 2007 would someone please explain to me how to insert Roman Numerlas in my document? "ckj" <ckj@discussions.microsoft.com> wrote in message news:6CF0C580-BA6E-463D-B4FD-E6A6FDD9E814@microsoft.com... > New to Word 2007 would someone please explain to me how to insert Roman > Numerlas in my document? Just type them... I II III IV V VI VII VIII IX X XI etc etc. Type a number e.g. 21, select it and run the following macro Dim oRng As Range Set oRng = Selection.Range oRng.Fields.Add oRng, 34, oRng.Text & " \*Roman"...

Reading XML files on WebServer
Hi, I am wanting to read an XML file sitting on a server and am wondering if I will run into problems with firewalls and/or proxy servers using the following simple bit of code: XmlTextReader reader = new XmlTextReader ("http://www.myserver.com/myxmlfile.xml"); It works fine with my interent connection. If some of the users are behind a proxy server it may cause a problem. Especially authentication proxy server. If you concern about these circumstances I suggest creating a WebRequest object and set the correct credentials, proxy server and then get the WebResponse objec...

Insert trigger
Looking for some advice on SQL 2005. I have a table that will usually be populated by an SSIS package. I want to set the "loaddate" column to the current time after a record is inserted. Should i do this via trigger or should i just build a step in the SSIS package to update the column after the file loads? If trigger is the way to go, what is the syntax to create the after insert trigger? Thanks in advance. You can create a default constraint on the table set to CURRENT_TIMESTAMP. That will handle the automatic date assignment without any need for coding. -...

Auto correct text changes
I am editing a document in word 2007 that has been saved in compatible mode. Whe I try to turn one heading into italics or bold it changes all the headings in the document to the same formatiing. Can any one help me to stop this happening. If I then press undo all the other changes revert back and not the one I have just made. I can't keep pressing undo everytime I make a change. I just want it to change the words I am highlighting See http://word.mvps.org/faqs/formatting/wholedocumentreformatted.htm. -- Stefan Blom Microsoft Word MVP "David Rudman"...

XML passing on URL
I have a site that when a user clicks on a hyperlink I want to send an XML stream to the page being linked to. How can I send this XML, either a file that exists or a document of type System.XML.XmlDocument? Is this possible? Thanks for any help. ...

inserting hrs and minutes
I have a cell in my time card that displays total weekly time -ex- "40:15" is there a way to make it more like this...40hrs,15mins -- Message posted from http://www.ExcelForum.com Use a custom format hh"hrs",mm"mins" -- Regards, Peo Sjoblom "-Brian-H- >" <<Brian-H-.110wgs@excelforum-nospam.com> wrote in message news:Brian-H-.110wgs@excelforum-nospam.com... > I have a cell in my time card that displays total weekly time -ex- > "40:15" is there a way to make it more like this...40hrs,15mins ? > > > ...

how do I filter on text format in Excel?
I have a workbook containing text that I wish to filter based on the format of some words. IOW, for instance, all records (rows) with cells containing text of a certain font color, or perhaps characters with the strikethrough mark. I'm relatively familiar with advanced filtering, but this appears to be something requiring a "filter by formula". Does anyone have any experience in this area? It is not in any built in function in Excel only way this would be possible would be to use a UDF (a function written using VBA) in a help column and then filtger on that help column pl...

insert an interactive excel file into word web page
I'm trying to insert a excel file into a word document with text, and then save it was as a web page, but I want to keep the excel part interactive. Any ideas? ...

XLS Just Dumping XML Problem
Hi New to xml, working from and O'Reily book... I have a simple bit of XML: <?xml version="1.0"?> <?xml-stylesheet type="application/xml" href="Transform.xsl"?> <ReportItems> <Textbox> <Style> <FontWeight>Bold</FontWeight> <PaddingBottom>6</PaddingBottom> </Style> <Value>Some Text</Value> </Textbox> </ReportItems> and a simple bit of XLS: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL...

Read 3 txt input files and create an XL spreadsheet
I have 3 txt files that contain data and i want to generate a single spreadsheet. 1 Text file contains the data as below: USER = GARYG PU SU CL CR CG 2. Text file contains data as : GEN WINDOW_LIST GARYGWL EXCEPTION = N ,INSTALLATION_DATA = NONE =MA , CAN , MULTI , WA , SDR , ETEL ; 3. Text file contains data as: USERCODE "GARYG" DEFAULT_WINDOW = NONE ,WINDOW_LIST = GARYGWL ; The report i am looking should be like this: USER ...

Insert | File > Attachmnet-Button Drop Down ;What is the difference between Insert and Insert As Attachmnet
re: "Outlook2003, File-Insert-Options" On making new-email with Attachment-File(s), ** File Menu | Insert | File >>> (Brows and select File to insert ) then we can see the button "Insert", and write side Drop Down Arrow lower-right side of Dialog Box; If it clicked, we can see three options as follows: ** Insert Insert as text Insert as Attachment I can not recognize/understand the difference between "Insert" and "Insert as Attachment" *** What is the difference between Insert and Insert As Attachment ? I would appreciate y...

XML -> PDF
Which is the easiest way to transform XML into PDF? Which tool/.Net library I should use? Zika Mustikla wrote: > Which is the easiest way to transform XML into PDF? Which tool/.Net library > I should use? It depends on what kind of typographic quality you want, and how much effort you want to put into getting it. The canonical answer is XSL:FO, using one of several FO processors (some free, some commercial). This has the advantage of using XML syntax, and thus "staying within the fold", but doing anything other than fairly trivial formatting means reinventing rather...

Inserting Hyperlinks in a Protected Sheet
Hi I run Excel 2000 and I have a protected worksheet that I share wit users in my organisation. I want to allow the insertion of a hyperlin to a specific file type within a specified directory on our server. 3 Questions: 1.Protection on disables the insert hyperlink command. Can this b overcome with worksheet activate code? 2.Can I limit the types of files (preferably by requiring the file t meet a mask format eg "z-*.xls")? 3.Can I limit the directory that can be linked, by referring to pathname stored in a cell on the active sheet? Would appreciate your suggestions. Thanks S...

how do I format text as strikethrough in Publisher 2003?
I am copying over text from a WordPerfect document into Microsoft Publisher 2003. Text that has been formatted as "Strikethrough" in the WordPerfect document comes over as plain text with no strikethrough. I have even tried to just import the document which it looks like it does fairly well at, except that all text formatted as strikethrough is imported as plain text. I can possibly believe that Publisher does not have any way to format text in this way, but I have looked everywhere and cannot figure out how to format the text in this way. Can anyone help? You will have to ...

Reading XML from a Continuously Updated XML Log File
Hello, We use an application that logs events to an xml file. I am starting a project to read these events at they are written to the log file and submit them to Operations Manager 2007 as custom events. I am currently writing a C# console app to read this file using XMLTextReader as part of a proof of concept. However, I am having problems reading the file after the application logs a new event. Log example: <?xml version="1.0" standalone="yes"?> <Log descName="foo"> <Session appName="appName" version="4.0" cmdLine=&quo...

Insert with a where condition
Hi, sql 2005 I have an insert statement that is ignoring the where condition. That is, I want to insert records when they do not already exist in the destination table. INSERT INTO dbo.tblmnuGroupPerm ( gId ,mtfID ,... ) SELECT @gID ,mtfID ,... FROM dbo.locmnuTabFunction AS ltf WHERE ltf.mtfID NOT IN ( SELECT gp.mtfID FROM dbo.tblmnuGroupPerm AS gp WHERE gp.gId=@gID AND gp.Deleted=0 ) Any ideas or recommendations appreciated :-) Many thanks, Jonathan It's OK... <oops "redFace">I did not correctly se...

Max size of OST files
Hi all, I'm making this post on behalf of a friend. They have a single Exchange2000 server. Not sure if it's SBS or Exchange2000 Std. There are approx 20 mailboxes on this server. The users all use Outlook 2003 (SP3) as their mail client and Outlook's account type is Exchange and not POP3 or IMAP. One of the users mailboxes is approx 6Gb in size. What they would like to do is use offline mode to create a .ost file of this persons mailbox for his laptop however the file limit on ost files appears to be 2Gb. We did find a MS k/b article that explained how to create the requi...

Insert
I want to overtype in a Publisher text box. I find I can only insert. The "insert" key doesn't do anything. ...

how to insert data in a table
Hi Exprets; I am creating an access database in which I want to insert data in already created table. Kindly help. Regards, Vikky Vikky <love.excel@gmail.com> wrote in news:1194124711.012302.269990 @e34g2000pro.googlegroups.com: > Hi Exprets; > > I am creating an access database in which I want to insert data in > already created table. > > Kindly help. > > Regards, > > Vikky > Data from where? Do you want to import it from excel, from a text file, copy it from another table or type it in manually? -- Bob Quintal PA is y I've altere...

How do you insert page numbers larger than 1000?
I have my purchase orders set up as a Publisher document. When our organization upgraded from Publisher 2000 to Publisher 2002, the new version set parameters on the page numbers. This was one of those things that worked just fine in the previous version... Does anyone know how to turn it off or change it? Hi mregen (mregen@discussions.microsoft.com), in the newsgroups you posted: || I have my purchase orders set up as a Publisher document. When our || organization upgraded from Publisher 2000 to Publisher 2002, the new || version set parameters on the page numbers. This was one of those...

insert downloads into power point
i downloaded an application called "BioDigital Simulator" of an animated cleft lip/palate surgery and need it put into my power point presentation, but can't fiugre out how to do so.... very frustrating... What kind of file is this application? Is it a video? If so, what kind? MPEG? AVI? MOV? Or is it an EXE file? Something else? Which version of PPT are you using? -- Echo [MS PPT MVP] http://www.echosvoice.com What's new in PPT 2010? http://www.echosvoice.com/2010.htm Fixing PowerPoint Annoyances http://tinyurl.com/36grcd PowerPoint 2007 Complete Makeover...

Insert dataset to another database
I'm posting this to this group also since it pertains to queries, primarily. Hello, Using VB6/ADO, I'm thinking I can create a recordset and insert it into another table in a different Jet database, all within the execution of a single query. But, I can't seem to get it to work, even in an experiment in Access 2K. My sql in Access 2K: SELECT D.lorder as Ord, A.Lorder FROM [;Database = C:\MyDocuments\Acc2K\Wrk.mdb].OrdersData as A INNER JOIN [;Database = C:\Access\Work\Sales06.mdb].Detl1 as D On D.Lorder = a.lorder WHERE ((D.fg)= 'MXX-NC' Or (D.fg)= 'MXX.NC')...

xml to excel #2
can anybody tell me how to transfer xml data to an excel template (worksheet) using asp.net ? Hi Ganesh, Regarding this issue of transferring the XML datato an excel template, I would request you to please go through teh following article to transfer the data from an access database to Microsoft Office Excel 2003. These include using the user-Interface, programmatically creating an XML file, transforming the data and reading it into Excel, and automating Excel and programmatically reading the data file : [Transfer XML Data to Microsoft Office Excel 2003 with Microsoft Visual Basic .NET] ht...

Insert a blank row
Hi, I need some help to insert a blank row in a range where column A has a series of dates. There will be several of the same dates and I need to both sort the dates and then insert the blank row at the end of each sequence. In the blank row I need to total figures that will be in columns B through to G. Thanks, Jim S Hi Jim maybe an easier solution 1. Sort your data (use 'Data - Sort', e.g., column A ascending) 2. Use 'Data - Subtotals' This will insert a row after each date and calculate subtotals automatically for you HTH Frank anon wrote: > Hi, > I need some...

text field validation 12-07-04
I am trying to create an validate event for Text fields on CRMAccount address fields. Whenever you try to change the values of these fields, it should alert the message. Here is the code like: In sfa\accts\acct_cont.js file, under window.OnLoad function: function window.onload() { ..... .... try { crmForm.address1_line1.onblur = validate; } catch (e) { alert("Error: " + e.message); } } function validate() { if (crmForm.ownerid.value == "{669282E2-2725-47A1-8234-3BD107C49487}") { alert("Not a authorized user. Please notify ...