Casa > H > How To Convert A .Txt File To A .Xml File

How to convert a .txt file to a .xml file

Just rename the .txt file to .xml file if all you want is an xml file. However, if you are interested in transforming the .txt file to a meaningful xml file, you have to break the information in the .txt file and organize it accrodingly.

For example, if you .txt file is like

  1. Sachin Tendulkar,Cricket,Batsman,India 
  2. Andrea Prilo, Football, Midfielder, Italy 

Then your xml might look like

  1. <?xml version="1.0" encoding="UTF-8"?> 
  2.  
  3.  
  4. Sachin Tendulkar 
  5. Cricket 
  6. Batsman 
  7. India 
  8.  
  9.  
  10.  
  11. Andrea Pirlo 
  12. Football 
  13. Midfielder 
  14. Italy 
  15.  
  16.  

This is how it is supposed to look in xml. So, you can use your language of interest and use the output statements to print/fill the .xml file appropriately.

De Evans

Como refrescar sua mente em dez minutos durante longas sessões de estudo :: Vale a pena comprar um Airtel Xstream para uma televisão inteligente?