Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
How to read the Text file to Xml.

Regards
Balamurugan
Posted
Updated 15-Oct-13 0:05am
v4
Comments
Thanks7872 15-Oct-13 6:33am    
Why?
Balamurugan1989 15-Oct-13 6:43am    
Can't get you...

if you mean simple conversion like you know for example there is a text file and you change it to pdf but it wont work cause the formats are different but if you use the xml code i mean like we write html in text editor.........

if you want this type of simple conversion..you can simply change the extension you know like book.html to book.pdf.......if the extension is not shown you need a little setting to make....go to folder options and unselect the option hide extentions for known file types........

if thats not what you want try to be more specific...........
 
Share this answer
 
Comments
Balamurugan1989 15-Oct-13 6:19am    
I'm having the text file in notepad i need to convert this file to Xml.
Ahsan98 15-Oct-13 6:22am    
yes and isnt the method i told you helping????
Balamurugan1989 15-Oct-13 6:24am    
Could you explain it briefly with the code.
Ahsan98 15-Oct-13 7:06am    
there is no code......all i said is just change the extension from .txt to .xml...thats the whole thing if extension(.txt isnt visible)...just use the method in the q to make it visible

hope this helps.........

Regards,
Ahsan Naveed
Balamurugan1989 15-Oct-13 7:42am    
I'm looking for reading text file to xml.I'm not going for changing the path.
if your text file contains xml, just load it with something like XDocument.Load, for example: http://stackoverflow.com/questions/670563/linq-to-read-xml.
If your file contains something which is not xml, you should parse the text and build xml from it. In this case you should edit your question and give more details.
 
Share this answer
 
What about a bit of googling first?
Is this what you want: http://stackoverflow.com/questions/15402493/convert-flat-text-file-to-xml-in-c-sharp[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900