Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET XML
hi
i have textboxe(s) and i wanna to insert the data that i fill the form with it in xml file..how i can do that..is there any code could help me ,since i try different codes and don't work with me
Posted 17-Jun-12 8:59am
Lotus90317
Comments
SAKryukov at 17-Jun-12 15:23pm
   
You don't explain where to insert and what should it mean, so it cannot be answered.
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The problem is: if you "try different codes" instead of doing programming, even if you get some help, it would be useless for you. You did not explain how you work with XML in general, where the data should be inserted, what's your goal. The question has nothing to do with ASP.NET, so you should remove this tag.
 
So, here is some ideas: 1) XML is structured, so you can insert some data in XML node, not XML; 2) you should work with XML, not XML file; so, you can read and parse the whole XML, modify it, and write the whole thing to the file; you can do it if the data is small enough to fit in memory; 3) better yet, you should work with data, not with XML; so learn about serialization and use it.
 
http://en.wikipedia.org/wiki/Serialization[^],
http://msdn.microsoft.com/en-us/library/ms233843.aspx[^],
http://msdn.microsoft.com/en-us/library/7ay27kt9%28v=vs.100%29.aspx[^],
http://msdn.microsoft.com/en-us/library/ms733127.aspx[^].
 
—SA
  Permalink  
Comments
jkirkerx at 17-Jun-12 18:06pm
   
I have to agree, it's like wanting to cook dinner, first you need to settle on a dish, figure out the receipe, and then aquire the food you need to prepare and cook the dish.
 
So first you create your xml file, with the required elements and nodes. And then you write code to read the file. Then write code to write the first xml file, and then write code to update the file with a new record.
 
With xml, you really can't just copy and paste your way to success.
Sergey Alexandrovich Kryukov at 29-Jun-12 22:40pm
   
Good point. But you can create data model first, then create a sample instance of data in memory and then run serializer to store it. Now you have a sample XML conforming the schema. You can read it back, use as a template to manual editing, whatever. Makes sense, right?
--SA
jkirkerx at 30-Jun-12 14:20pm
   
I was just trying to simplify the thinking process for XML.
 
I personally create the model by writing out the XML file by hand, and then I create XSD code to match the file. Next I test the XSD, to make sure it creates the multiple element records correctly.
 
After that, I run the XSD against xsd.exe to create a class, and use the class to read, write and update. I use XMLTextWriter and XMLTextReader, and it works quite well.
 
I just looked at your name, and realized that your the Russian guy with a million points, who's way beyond my skill level.
Sergey Alexandrovich Kryukov at 30-Jun-12 23:50pm
   
Yes, I'm Russian, but absolutely not sure about comparison of skill levels. The most common situation is when skills cannot be compared. And no points really measure them... :-)
--SA
jkirkerx at 1-Jul-12 1:22am
   
Well, that was modest and well thought out, and I feel better about the level playing field which is not measured by points. Not so intimated now.
 
I've always been fascinated by Russian Programmers. I have a deep respect for them. I have lots of questions.
Sergey Alexandrovich Kryukov at 1-Jul-12 2:16am
   
Questions like what? Where did they learn programming? :-)
There was an article with the information of one of the major commercial firms in Russia, that they used an unwritten policy: never hire a developers with any "software" or "computer" degree — their background and experience is unsatisfactory. Even though I don't think that firm's products were any good, there is a rational grain in this policy. Usually, the best developers have different education, typically with good mathematical background, which helps to think in depth and better see the essence of things. The curse of traditional "technical" education is that they tend to substitute values in the formula they don't understand, search ready-to-use solutions, use some programs and trust the results of all that without critical thinking, using their brain instead. This is really a problem in technical education in the whole word and of so called "professionalism". I really don't think I'm one of the best developers, but I can clearly see the lack of deep knowledge and understanding of essence of things in most engineers, as well as the lack of fundamental approach...
--SA
jkirkerx at 1-Jul-12 17:47pm
   
That was one, which is well answered. Is it ok to private message the other?
Sergey Alexandrovich Kryukov at 2-Jul-12 4:17am
   
Private message to me? I don't mind, but please understand that I cannot guarantee anything. I can be reached via my Web site you can find in my CodeProject profile...
 
If this is a technical problem(s), the CodeProject post is the best option. If you want, you can notify me personally...
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 481
1 Maciej Los 345
2 OriginalGriff 308
3 Yogesh Kumar Tyagi 304
4 Prakriti Goyal 200
0 OriginalGriff 6,367
1 Sergey Alexandrovich Kryukov 5,296
2 Maciej Los 3,384
3 Peter Leow 3,259
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 17 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100