Hi Guys,
can anyone tell me how can i convert plain text to XMl.thanks

Recommended Answers

All 3 Replies

well, my first guess would be have something that would search for key words using the regex, and then doing something based on it, and using System.IO; to write/read the textfile. The best way I can explain this would be by assuming a few things, XML version by standard would be 1.0, so before you get started even converting anything write this to the file:
<?xml version="1.0">
...reasoning for this is because this is needed for an xml file, and then you could go ahead and add your other things like...xml heading tags, auto-add date(meaning it prints the date to the file for you each time you "convert" text to xml), and things like that. dont forget to add the ending xml tags too when your doing all of this. if your making an app to do all of this let the user pick from options for making the xml file, because even if they never use the options its nice to be able to say you have them, options and appearance sells, basic and crappy apps dont.
I'm replying to this going off only what you told me, so next time to help you out and everyone else, please add more, maybe a short story, some details, makes getting help easier.
Good luck, and reply if you have questions/comments.

hi , sorry for not describing it properly,basically i have a plain text which i need to store in databse and at the same time i need to create xml file for tht text. User will not have to do anything with this.This is just one time thing.My second questionis, how will i create tags?How will i know about tags?Thanks for all the help

An XML file can be created and edited using an XmlDocument object and other classes from the System.Xml namespace.
However, there are other ways to create XML documents (e.g. from a DataTable or DataSet).
It depends very much on what you mean by "plain text".

As spdesings pointed out you have not given enough information to give a fuller answer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.