locked
Converting XML to Text (.doc) RRS feed

  • Question

  • Does anyone have a suggestion on how to convert an XML file to a .doc file that I can read as text?

    Thanks

    Thursday, September 22, 2011 6:10 PM

Answers

  • HI lataylor5,

    XML values have Keys and Values.  You want the values.  Here is the MS Support article (with code) on how to read and XML file: http://support.microsoft.com/kb/307548

    You can write it to the console and capture the output to a text file (myProgram.exe >> myfile.txt)

    OR

    You can use System.IO namespace: Here is the MS tutorial on writing to text file using it: http://msdn.microsoft.com/en-us/library/8bh11f1k.aspx

     

    The examples are basic and should be all you need.  If you run into specific questions please create another thread.

    Please mark as answer if this seems to be the answer (it is).

     

    cs 

     

    • Proposed as answer by CountryStyle Friday, September 23, 2011 5:44 PM
    • Marked as answer by Leo Liu - MSFT Thursday, September 29, 2011 3:53 AM
    Friday, September 23, 2011 5:44 PM

All replies

  • If you don't have the answer already...

    1) a *.doc file is an MS Word file.  Do you want a word file or a text file with a *.txt extension?

    2) xml is already a text file

    since xml is already a text file you can read can you post and example of the input and the desired output?

    c# has a few classes to work with XML files.

     

    cs

    Thursday, September 22, 2011 6:52 PM
  • What I mean is that I need to be able to take the code that is on the xml page and turn it into the text that I can read like a book. I cannot read the code. Do you know of any converters that you put the code into and it turns it into text you can actually read?
    Friday, September 23, 2011 3:44 PM
  • HI lataylor5,

    XML values have Keys and Values.  You want the values.  Here is the MS Support article (with code) on how to read and XML file: http://support.microsoft.com/kb/307548

    You can write it to the console and capture the output to a text file (myProgram.exe >> myfile.txt)

    OR

    You can use System.IO namespace: Here is the MS tutorial on writing to text file using it: http://msdn.microsoft.com/en-us/library/8bh11f1k.aspx

     

    The examples are basic and should be all you need.  If you run into specific questions please create another thread.

    Please mark as answer if this seems to be the answer (it is).

     

    cs 

     

    • Proposed as answer by CountryStyle Friday, September 23, 2011 5:44 PM
    • Marked as answer by Leo Liu - MSFT Thursday, September 29, 2011 3:53 AM
    Friday, September 23, 2011 5:44 PM