Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2010
    Thanked 0 Times in 0 Posts

    Convert text file into XML file


    I have a txt file which I want to convert into an XML file. The content of the .txt file is as below:

    Hour Ending 0 1 2 3 4 5 6
    Predicted Price 2.0 2.0 1.7 1.6 1.5 1.9
    Actual Price 2.3 2.3 2.1 2.1 2.0 2.1

    I want to convert the above in XML as follows:

    <Hour Ending> 0 </Hour Ending>
    <Predicted Price> 2.0 </Predicted Price>
    <Actual Price> 2.3 </Actual Price>

    <Hour Ending> 1 </Hour Ending>
    <Predicted Price> 2.0 </Predicted Price>
    <Actual Price> 2.3 </Actual Price>

    What is the best approach? Do I need to covert the txt file into an excel sheet first, or can I map it directly to XML elements as above?

    Any advice will be great.

  2. #2
    Senior Coder
    Join Date
    Sep 2010
    Thanked 275 Times in 275 Posts
    How is the XML file being generated now? You would want to use whatever software is being used now, to add this data. And exactly
    how you do it will be determined in part by the type of software.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts